不知道哪里出错了,图片一直出不来
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Image Objcet</title>
<script language="javascript">
var image1 = new Image();
image1.src = "images\1.jpg";
var image2 = new Image();
image2.src = "images\2.jpg";
var image3 = new Image();
image3.src = "images\3.jpg";
function loadCached(list){
var img = list.options[list.selectedIndex].value;
document.thumbnail.src = eval(img + ".src");
}
</script>
</head>
<body>
<h2>Image Object</h2>
<img src="images\1.jpg" name="thumbnail" height="90" width="120" />
<form>
<select name="cached" onchange="loadCached(this)">
<option value="image1">Bands
<option value="image2">Clips
<option value="image3">Lamp
</select>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Image Objcet</title>
<script language="javascript">
var image1 = new Image();
image1.src = "images\1.jpg";
var image2 = new Image();
image2.src = "images\2.jpg";
var image3 = new Image();
image3.src = "images\3.jpg";
function loadCached(list){
var img = list.options[list.selectedIndex].value;
document.thumbnail.src = eval(img + ".src");
}
</script>
</head>
<body>
<h2>Image Object</h2>
<img src="images\1.jpg" name="thumbnail" height="90" width="120" />
<form>
<select name="cached" onchange="loadCached(this)">
<option value="image1">Bands
<option value="image2">Clips
<option value="image3">Lamp
</select>
</form>
</body>
</html>
解决方案 »
- ajax里面的for循环问题
- 如何用js控制html里的table让某列固定,实现类似Excel里列固定的效果
- 如何退回页后显示上次内容
- js eventClientX
- jQuery的基本用法,请大家帮我看看
- var matchExp ="^http[s]?:\\/\\/([ \\w-]+\\.)+[\\w-]+...";
- 请教: dtree源代码中的函数是怎样被调用的
- 如何判断表格中某一行的text元素被改动
- 我要弹出一个窗口使得浏览器右上角那个关闭按钮不能用,这该怎么实现?
- 我想把一段比较长的json用jquery ajax通过post发送给服务器,应该怎么传?
- 父页面_子页面 跨域问题
- ★★小白:不能执行已释放 Script 的代码
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Image Objcet</title>
<script language="javascript">
var image=["images\\1.jpg","images\\2.jpg","images\\3.jpg"];
function loadCached(list){
var img = list.selectedIndex;
alert(image[img]);
document.thumbnail.src =image[img];
}
</script>
</head>
<body>
<h2>Image Object</h2>
<img src="images\1.jpg" name="thumbnail" height="90" width="120" />
<form>
<select name="cached" onchange="loadCached(this)">
<option value="image1">Bands
<option value="image2">Clips
<option value="image3">Lamp
</select>
</form>
</body>
</html>
<img src="images\1.jpg" name="thumbnail" height="90" width="120" id="thumbnail" />
<form>
<select name="cached" onchange="loadCached(this)">
<option value="images\1.jpg">Bands</option>
<option value="images\2.jpg">Clips</option>
<option value="images\3.jpg">Lamp</option>
</select>
function loadCached(list){
document.getElementById('thumbnail').src =list.value;
}