can't focus form with script

J

Joe Butler

Any ideas why this form is not focusing on the text area control?
Doesn't focus in FF1 or IE6 - nothing else tested, since it should work with
these as google works (but with a different script).

scripts are allowed to run in FF and IE.


<a name="event16">
</a>

<form name="form16" class="event" style="width: 80%;"
action="/cal/index.php" method="post">
<a href="/cal/index.php?cancel=16">&nbsp;cancel&nbsp;</a>

<input value="save" type="submit">
<input name="idsave" value="16" type="hidden">
<textarea name="edit" rows="5" cols="60">df df</textarea>
</form>

<script type="text/javascript">
<!-- document.form16.edit.focus();
// -->
</script>
 
J

John L.

Joe said:
Any ideas why this form is not focusing on the text area control?
Doesn't focus in FF1 or IE6 - nothing else tested, since it should work with
these as google works (but with a different script).

scripts are allowed to run in FF and IE.


<a name="event16">
</a>

<form name="form16" class="event" style="width: 80%;"
action="/cal/index.php" method="post">
<a href="/cal/index.php?cancel=16">&nbsp;cancel&nbsp;</a>

<input value="save" type="submit">
<input name="idsave" value="16" type="hidden">
<textarea name="edit" rows="5" cols="60">df df</textarea>
</form>

<script type="text/javascript">
<!--
// -->
</script>

From http://www.w3.org/TR/html401/interact/scripts.html#h-18.3.2:

Commenting scripts in JavaScript
The JavaScript engine allows the string "<!--" to occur at the start of
a SCRIPT element, and ignores further characters until the end of the line.

So put your statement on a new line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top