简体   繁体   English

Javascript或jQuery。 启动从输入文本中提取的多个URL

[英]Javascript or jQuery. Launch multiple URLs pulled from input text

I wrote a basic function as follows: 我编写了一个基本函数,如下所示:

        function launchIt() {
            var input = document.getElementById('webaddy'),
                webAddy = input.value;
            if (webAddy) {
                    // initialize array
                    var arr = new Array(6);
                    arr[0] = "/css/img/bg-home.jpg?reset=1";
                    arr[1] = "/css/img/bg-large.jpg?reset=1";
                    arr[2] = "/css/img/bg-medium.jpg?reset=1";
                    arr[3] = "/css/img/bg-small.jpg?reset=1";
                    arr[4] = "/css/img/bg-xlarge.jpg?reset=1";
                    arr[5] = "/css/img/bg-xsmall.jpg?reset=1";

                    // display all values
                    for (var i = 0; i < arr.length; i++) {
                        alert(webAddy + arr[i]);
                    };
            }
        }

It works. 有用。 I get the web address from the webaddy input field's value. 我从webaddy输入字段的值获取网址。 I want to change the alert() to something like window.open . 我想将alert()更改为window.open东西。 I have tried window.open , but it only opens the first array item and then stops. 我试过window.open ,但它只打开第一个数组项,然后停止。 Any suggestions? 有什么建议么?

It was my browser's built-in popup block! 这是我的浏览器的内置弹出窗口块! Thanks to @user1105047! 感谢@ user1105047!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 javascript jQuery 进行输入。? - How to make an input with javascript jQuery.? 如何使用javascript或jquery查找文本。 - How to find a text using javascript or jquery. Javascript / JQuery如何从多个选择输入中获取文本 - Javascript/JQuery how to get text from multiple select input jQuery。 找到所有 <tr> 包含所选文字 <option> - Jquery. Find all <tr> containing text from selected <option> Javascript数组-从从文本框提取的字符串创建(jQuery) - Javascript Array - Creating from string pulled from textbox (jquery) 图像可以从外部从源中拉出 <img src=“…” /> 。 可以在没有JavaScript的情况下从外部拉TEXT吗? - Images can be pulled externally from a source <img src=“…” />. Can TEXT be pulled externally without javascript? <span src=“…”> jQuery的。 等待模态Bootstrap中的输入值 - jQuery. Wait input values in modal Bootstrap 使用 javascript + jquery 轻松重新设计输入类型文件。 需要 Css 修复 D: on jsfiddle - Easy restyling of input type file with javascript + jquery. Css fix needed D: on jsfiddle jQuery。 检测输入类型“日期”的更改 - Jquery. Detect changes on input type 'date' 如何在不使用 JavaScript 或 jQuery 的情况下将 div 的文本绑定到隐藏字段? - How to bind a div's text into the hidden field without using JavaScript or jQuery.?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM