JavaScript and client side scripting.
Moderator: General Moderators
dakkonz
Forum Commoner
Posts: 69 Joined: Sat Dec 27, 2003 2:55 am
Location: Asia
Post
by dakkonz » Tue Jan 06, 2004 8:49 am
<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
uberpolak
Forum Contributor
Posts: 261 Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar
Post
by uberpolak » Tue Jan 06, 2004 5:54 pm
<script type="text/javascript">
document.write('<option value="General"');
if (subgenre=="General") {document.write(' selected="selected">');}
else {document.write('>');}
document.write('General</option>');
</script>
dakkonz
Forum Commoner
Posts: 69 Joined: Sat Dec 27, 2003 2:55 am
Location: Asia
Post
by dakkonz » Tue Jan 06, 2004 9:08 pm
okay thanks a million
uberpolak
Forum Contributor
Posts: 261 Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar
Post
by uberpolak » Tue Jan 06, 2004 9:29 pm
You're welcome seven hundred forty-two thousand, six hundred and three.