PDA

View Full Version : Selection and display problem



Dimi Cost
04-15-2011, 01:50 AM
I have problem ,the code cannot operate. I would like your opinion.The user must select in dropdown list having one display of image every time.Thanks

js code

var sel = document.getElementById("sw");
function f1(){
var imgs = ['chart1.cgi', 'chart2.cgi', 'chart3.cgi', 'chart4.cgi'];
var im = document.getElementById("pic");
im.src = imgs[this.selectedIndex];
}

html code

<img id="pic" src="chart1.cgi" />

<select name="sw" id="sw" onchange = "f1()" >
<option value="s1">what</option>
<option value="s2">whatever 2</option>
<option value="s3">whatever 3</option>
<option value="s4">whatever 4</option>
</select>

davelf
04-15-2011, 02:55 AM
any link we can see, cause there's a lot of dropdown script out there. Which one did you use.

Dimi Cost
04-15-2011, 10:21 AM
Hello, link about what.In dropdown list s1 ,s2,s3,s4 must selected in order to display any of 4 chart.cgi.Thanks