Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么imagepicker程序js中的此函数不起作用?_Javascript_Debugging - Fatal编程技术网

Javascript 为什么imagepicker程序js中的此函数不起作用?

Javascript 为什么imagepicker程序js中的此函数不起作用?,javascript,debugging,Javascript,Debugging,我有这个功能的问题,我使用这个,我想为用户创建一个选项,以转发到适当的网站后,选择适当的图像。转发正在工作,但出现带有此代码的图像。有什么想法吗 <!DOCTYPE HTML> <html> <head> <link rel="stylesheet" href="css.css"> <script src="js.js"></script> <!-- scripts for imagepicker -->

我有这个功能的问题,我使用这个,我想为用户创建一个选项,以转发到适当的网站后,选择适当的图像。转发正在工作,但出现带有此代码的图像。有什么想法吗

<!DOCTYPE HTML>
<html>

<head>
<link rel="stylesheet" href="css.css">
<script src="js.js"></script>



<!-- scripts for imagepicker -->
    <link rel="stylesheet" href="image-picker.css">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript" src="image-picker.js"></script>
    <script type="text/javascript" src="image-picker.min.js"></script>
    <script type="text/javascript">
        "use strict";
        //wait for the page to be fully loaded
        window.onload = function() {
            initialize();
        }
    </script>



</head>
<body>


<!--code for imagepicker-->
<select multiple="multiple" class="image-picker show-html" id="selectImg">
  <option data-img-src="http://placekitten.com/220/200" value="http://cats.com">Cute Kitten 1</option>
  <option data-img-src="http://placekitten.com/180/200" value="http://dogs.com">Cute Kitten 2</option>
  <option data-img-src="http://placekitten.com/130/200" value="http://dogsandcats.com">Cute Kitten 3</option>

</select>

<button href="#" id="forwardButton">Forward</button>

<script>

function initialize() {

    var choice = document.getElementById("selectImg").value;

    //changes destination when you set or change your choice
    document.getElementById("selectImg").onchange = function() {
        choice = document.getElementById("selectImg").value;
    }

    //when button is clicked
    document.getElementById("forwardButton").onclick = function() {
        if (choice !== ("" || "undefined")) {
            window.location = choice;
        }       
    }
}

</script>
</body>
</html>

我想你还没有初始化图像选择器

然后在目标元素上调用imagepicker。 $select.imagepicker


为什么要加载image-picker.js和缩小版中的同一个文件?

只是最近代码中的一个错误:正在工作。非常感谢你