Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript and ASP

Status
Not open for further replies.

mickywall

Programmer
Sep 2, 2002
88
GB
How can i write this code so it will get a recordset colorPath
recordset("colorPath")
and loop through the drop down menu and if the recordset colorPath is the same as the image path then it will have that option selected.


<script LANGUAGE=&quot;javascript&quot;>
<!--
var images = new Array(
&quot;/images/orange.gif&quot;,&quot;Orange&quot;,
&quot;/images/blue.gif&quot;, &quot;Blue&quot;,
&quot;/images/brown.gif&quot;,&quot;Brown&quot;,
&quot;/images/images/green.gif&quot;,&quot;Green&quot;
);
//-->
</script> <script LANGUAGE=&quot;javascript&quot;>
<!--
function displayImage()
{
var IFname = document.formsettings.s.options[document.formsettings.s.selectedIndex].value;
document.im.src = IFname;
}
document.writeln('<select name =&quot;s&quot; onChange =&quot;displayImage()&quot;>');
document.write('<option selected value=&quot;',images[0],'&quot;> ');
document.writeln(images[1],' </option>');
for (i=2; i<images.length; i+=2)
document.writeln('<option value=&quot;',images,'&quot;> ',images[i+1],' </option>');
document.writeln('</select>');

document.writeln('&nbsp;&nbsp;&nbsp;&nbsp;<IMG name=&quot;im&quot; SRC=&quot;',images[0],'&quot; BORDER=0>');

//-->

</script>

thanks
 
this should do it:

function displayImage(){
if(document.formsettings.s.selectedIndex!=-1){
var IFname = document.formsettings.s.options[document.formsettings.s.selectedIndex].innerHTML;
document.im.src = IFname;
}
}
 
Duplicate:
thread333-478468
thread216-481588
thread333-481611


-Tarwn ________________________________________________
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Tarwn
i apologise for any duplication, but i have spent hours and hours and still havent got this to work... :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top