How to set focus to a radio button without <body>

message from WestSide on 21 Jul 2004
Hi,

I wanted to find out... does anyone know how to set focus to a radio button
when the page loads, besides using the body tag.

Currently the body tag in this app has an OnLoad event... is there another way?

Ideally something where I could use on all my forms would be cool, but if not,
I will take what I can get..

Any thoughts?

-WestSide
 
Gary White replied to WestSide on 20 Jul 2004
In addition to the other replies, you can insert a small script block in the
body of the page as long as it is AFTER the object you're setting focus to.
I'd suggest putting it right before the closing </body> tag.

Gary
 
Michael Fesser replied to WestSide on 21 Jul 2004
.oO(WestSide)

You can have multiple scripts/calls on the onload-event, separated by
semi-colons:

<body onload="doThis(); doThat(); doNothing(); wasteTime();">

HTH
Micha
 
Josh Johnson replied to Michael Fesser on 20 Jul 2004
Or to keep it simple, I usually create an initialization function like

<body onload="init();">

and then call all the startup functions in one script in the head like

<script>
function init() {
doThis();
doThat();
doNothing();
wasteTime();
}
</script>

A little bit longer, but I find it easier to read and debug, since it's
easy to comment out one function at a time for testing.

- Josh
 

Archived message: How to set focus to a radio button without <body> (Macromedia Dreamweaver Web Design)