Page 1 of 1

any problem with this statement

Posted: Tue Jan 06, 2004 8:49 am
by dakkonz
<javascript>
<option value="General" if(subgenre == "General") document.write("SELECTED");>General</option>
</script>

is it okay if i write a statement like this?? will it work??
subgenre is a variable...
i have a form and wanna display the value that is obtained from the database in a select form

Posted: Tue Jan 06, 2004 5:54 pm
by uberpolak
<script type="text/javascript">

document.write('<option value="General"');
if (subgenre=="General") {document.write(' selected="selected">');}
else {document.write('>');}
document.write('General</option>');

</script>

Posted: Tue Jan 06, 2004 9:08 pm
by dakkonz
okay thanks a million

Posted: Tue Jan 06, 2004 9:29 pm
by uberpolak
You're welcome seven hundred forty-two thousand, six hundred and three.