Forum Moderators: open
<script language='javascript'>
seldisp = documnet.getElementById('displayed');
seldisp.selectedIndex = '1';
</script>
<form name="editpage">
<select name="displayed">
<option>Yes</option>
<option>No</option>
</select>
</form>
error:
document is undefined.
this script is inside body tag and i have to use it inside body since this is being used in PHP.
Thanks
First off you have a misspelling. Document was spelled incorrectly. The following should work:
<script type="text/javascript">
seldisp = document.editpage.displayed;
seldisp.selectedIndex = 1;
</script>
Notice how I removed the "getElementById" method because you actually didn't specify the ID of the element, only the name. If you wanted to use what you had, it should be written like the following:
<select [b]id[/b]="displayed">