The following code is what I have in my assignment. I need to make the cursor au
ID: 3531631 • Letter: T
Question
The following code is what I have in my assignment. I need to make the cursor automatically be in the UserName field on load. I don't know where to put that code or what code to use. I also am having trouble getting the uppercase code to work. Please help me figure out what I'm doing wrong.
here's the code:
<form id="form1" name="form1" method="post" action="" >
<span id="sprytextfield1">
<label for="UserName">User Name</label>
<input type="text" name="UserName" id="UserName" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
</form>
<script>
var str= document.form1.UserName.UserName;
document.write(str.toUpperCase());
</script>
Explanation / Answer
<form id="form1" name="form1" method="post" action="" >
<span id="sprytextfield1">
<label for="UserName">User Name</label>
<input type="text" name="UserName" id="UserName" />
<script>document.getElementById('UserName').focus()</script>
<span class="textfieldRequiredMsg">A value is required.</span></span>
</form>
<script>
var str= document.form1.UserName.UserName;
document.write(str.toUpperCase());
</script>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.