Hi,
I have a piece of html like below, and it's working. But the problem is the part that I pass the variable of file path on
Quote:
|
<input id="but" type="button" value="<" onclick="mainwin('main_img', 'ima/2.jpg');" />
|
It seems only the file path start with "img" will work, I tried image/1.jpg, 1/1.jpg .... or even img/1/1.jpg, none of them will load the image. Javascript seems to treat it like a broken path, or broken script.
Has anyone any idea what's goning on here? My initial intention was to store 3 side of picture under the directory of one entity, according to the entity's id.
Like
/1/1.jpg
/1/2.jpg
/1/3.jpg
/2/1.jpg
...etc
Now i feeling like having a problem to tell my team mate about my "idea"....
Please help, the most importantly, what's going on, any information is appreciated
Quote:
<html>
<head>
<script language="javascript" type="text/javascript">
function mainwin(imgname, imgsrc)
{
document[imgname].src = imgsrc;
}
</script>
</head>
<body>
<img src="1/1.jpg" name="main_img" width="200px" height="150px" />
<br/>
<input id="but" type="button" value="<" onclick="mainwin('main_img', 'ima/2.jpg');" />
</body>
</html>
|