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+"','')/>");
}
onclick='window.open(urls)' //单引号
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+"')/>");
}
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+"')/>");
}注意红色部分你这个好象是获取本地的
你原来代码打开的是urls这个变量存储的值了...
因为你的
var urls = "showFullPicture.html?name=" + filePath;就是一个变量
楼上大大们的应该都可以
点击后做什么?打开一个新窗口么?你的WINDOW.OPEN就是要打开一个新的URL啊
我就是打开一个新的url~~
<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>怎么这个代码提示语法错误的?
大家看看自己机上有没有错?