Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems w/ Selection.setFocus in Web Page

Status
Not open for further replies.

clemrock

Programmer
May 20, 2004
118
US
Hello, It's me again.

I'm trying to set the curser focus in a text field when a movie clip loads in a webpage.

The following code works great in the authoring environment but, when you view it in a webpage, it does not show the cursor in the text field.

Current Code I'm using:
Code:

_root.focusEnabled = true; Selection.setFocus("username_txt");


Also, I've also had some success only in Windows IE by using the above code in conjunction w/ the following javascript in the webpage:


<body onLoad="window.document.theMovie.focus();">

<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" width="900" height="540" name="theMovie">
<param name="movie" value="main_program_v1.swf">
<param name="quality" value="high">
<embed src="main_program_v1.swf" quality="high" pluginspage=" type="application/x-shockwave-flash" width="900" height="540" name="theMovie"></embed>
</object>

Thanks for your time,
Clem C
 
Try "getElementById" instead:

[tt]onload="document.getElementById('theMovie').focus()"[/tt]

Obviously you have to add [tt]id='theMovie'[/tt] to <object> and <embed> tags.

I think you can remove [tt]_root.focusEnabled = true[/tt].

Kenneth Kawamoto
 
I've tried all of these methods and none work:


onLoad="document.getElementById('theMovie').focus();"
onLoad="window.document.theMovie.focus();"
onLoad="window.document.focus();"

It seems like there has to be an easy solution because it seems to be such a common need.

Thanks for your help,
Clem C
 
Yeah - tried that too. No Dice.

Thanks for your help.
 
I tested it just now and while it works on IE, doesn't work on FireFox.

Macromedia technote says:
"Note: This method only works on Windows versions of Internet Explorer."

I will investigate further...

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top