S
Steven
Hi I'm new to js so this prob is a simple question but I haven't been
able to solve it.
I have 2 text fields which let me pick a graphic file and want to
display then in 2 image place holders so I want to call a function
SetImg passing the id of the input file and the image name to to set
the source to the file value fron the input field. Here is what I have
done
<head>
//Javascript function
<script type="text/javascript" language="javascript">
function SetImg(fieldIn, imageToSet) {
var path = document.getElementById(fieldIn).value;
document.getElementById(imageToSet).scr = path;
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<input name="Browse1" type="file" id="Browse1" value=""
onchange="SetImg(Browse1, img1)"/>
<input name="Browse2" type="file" id="Browse2" value=""
onchange="SetImg(Browse2, img2)"/>
</form>
<img name="img1" src="" width="64" height="64" alt="">
<img name="img2" src="" width="64" height="64" alt="">
</body>
But this doesn't set the image.Can some please tell me what I'm doing
wrong
able to solve it.
I have 2 text fields which let me pick a graphic file and want to
display then in 2 image place holders so I want to call a function
SetImg passing the id of the input file and the image name to to set
the source to the file value fron the input field. Here is what I have
done
<head>
//Javascript function
<script type="text/javascript" language="javascript">
function SetImg(fieldIn, imageToSet) {
var path = document.getElementById(fieldIn).value;
document.getElementById(imageToSet).scr = path;
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<input name="Browse1" type="file" id="Browse1" value=""
onchange="SetImg(Browse1, img1)"/>
<input name="Browse2" type="file" id="Browse2" value=""
onchange="SetImg(Browse2, img2)"/>
</form>
<img name="img1" src="" width="64" height="64" alt="">
<img name="img2" src="" width="64" height="64" alt="">
</body>
But this doesn't set the image.Can some please tell me what I'm doing
wrong