any problem with this statement

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

any problem with this statement

Post 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
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post 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>
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

Post by dakkonz »

okay thanks a million
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

You're welcome seven hundred forty-two thousand, six hundred and three.
Post Reply