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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp and javascript

Status
Not open for further replies.

mickywall

Programmer
Sep 2, 2002
88
0
0
GB
If i open a connection and a recordset to my table which returns
color=recordset("color")
how could i get the javascript below to option select the array image that is equal to 'color' ie. the recordset returned

<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/green.gif&quot;,&quot;Green&quot;
);
//-->
</script> <script LANGUAGE=&quot;javascript&quot;>
<!--
function displayImage()
{
var IFname = document.form.s.options[document.form.s.selectedIndex].value;
document.im.src = IFname;
}
document.writeln('<form name=&quot;form&quot; method=&quot;POST&quot;>');
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></form>');
document.writeln('</select>');

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

</script>

thnks..
 
NOt sure what you need but this might help.
Javascript....


for (x=0; x<images.length; x++){
if (images[x] == &quot;<%=color%>&quot;){
//do what you want with it...
}
} Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
mikewolf@tst-us.com (Do not email regarding this thread unless requested - I don't check this account regularly)
 
Please try not to post threads multiple times, continuing the conversation on on thread will cut down on repitition:
thread333-478468
thread216-481588
thread333-481611


-Tarwn ________________________________________________
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top