|
-
May 9th, 2001, 02:20 AM
#1
Thread Starter
Hyperactive Member
window_onload()
Hello,
Can anyone please give me some example code of the window_onload() event!?
I'm not very clued up with Java. Do you just put this event right at the top of your page and it will "fire" whenever the page is loaded??
What I want to do is set the focus to "textbox1" when the page loads.
Thanks,
T
-
May 9th, 2001, 02:51 AM
#2
You can use this little tiny script for window_onload()
Code:
<title></title>
<script language=javascript>
<!--
function window_onload() {
}
//-->
</script>
</head>
And place this code in your body tag.
Code:
language=javascript onload="return window_onload()"
But i dont know how you can focus a object on you pages
-
May 9th, 2001, 03:39 AM
#3
New Member
lo,
this may be worth a try.
put this bit in between the <head></head> tags:
Code:
<script language="Javascript">
<!--
function SetFocus(formfield){
var theForm = document.forms['FORMNAME']
theForm[formfield].focus();
}
//-->
</script>
Then in the <body> tag add:
onload="SetFocus('FIELDNAME')"
just replace the FORMNAME and FIELDNAME with the correct names of the form and field you wish to use.
Hope that helps, well hope it works tbh
-
May 9th, 2001, 04:20 AM
#4
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|