for(var i=0 ; i<fileNames.length ; i++) {
    fileName = fileNames[i];
    filePath = "file:///" + usbPath + fileName;
        var urls = "showFullPicture.html?name=" + filePath;                    
        document.write("<img src='" + filePath + "' width=144px height=115px onclick=window.open('"+urls+"','')/>");
}

解决方案 »

  1.   


    onclick='window.open(urls)' //单引号
      

  2.   

    for(var i=0 ; i<fileNames.length ; i++) {
        fileName = fileNames[i];
        filePath = "file:///" + usbPath + fileName;
            var urls = "showFullPicture.html?name=" + filePath;                    
            document.write("<img src='" + filePath + "' width=144px height=115px onclick=window.open('"+urls+"')/>");
    }
      

  3.   

    for(var i=0 ; i<fileNames.length ; i++) {
        fileName = fileNames[i];
        filePath = "file:///" + usbPath + fileName;
            var urls = "showFullPicture.html?name=" + filePath;                    
            document.write("<img src='" + filePath + "' width=144px height=115px onclick=window.open('"+urls+"')/>");
    }注意红色部分你这个好象是获取本地的
      

  4.   


    你原来代码打开的是urls这个变量存储的值了...
      

  5.   

    onclick=window.open(urls) 这么写就写死了,而应该写成动态的
    因为你的
    var urls = "showFullPicture.html?name=" + filePath;就是一个变量
    楼上大大们的应该都可以
      

  6.   

    可点击的图片?
    点击后做什么?打开一个新窗口么?你的WINDOW.OPEN就是要打开一个新的URL啊
      

  7.   

    没有错啊~
    我就是打开一个新的url~~
      

  8.   


    <html>
    <head>
    <script type="text/javascript">

    function openWin() { 
    var filePath ="e:/1.jpg";
    var urls = "testb.html?name="+ filePath;
         document.write("<img src='" + filePath + "' width=144px height=115px onclick=window.open('" + urls + "')/>");

    </script> 
    </head>
    <body>
    <input type="text" id="times" /> 
    <script type="text/javascript">
    openWin();
            </script>
    </body>
    </html>怎么这个代码提示语法错误的?
    大家看看自己机上有没有错?
      

  9.   

     chinmo 的正确。你的url是在创建连接的时候存在的变量,如果要把它传到onclick事件中,必须和字符串分出来组合。