By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,322 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

Recursively Find a Control?

P: n/a

I have some web-server-side code that may place a textbox anywhere on a
page. It might be on the page itself, it might be within a <form>, it
might be within a <div> in the form, or in a <div> inside the first
<div>.

Is there a script out there that will let me, given just the control's
ID, recursively find it anywhere on the page so I can set focus to it?

Any pointers appreciated - this is making me nuts!

Thanks.

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
br************@hotmail.com wrote:
I have some web-server-side code that may place a textbox anywhere on a page. It might be on the page itself, it might be within a <form>, it
might be within a <div> in the form, or in a <div> inside the first
<div>.

Is there a script out there that will let me, given just the control's ID, recursively find it anywhere on the page so I can set focus to it?
Any pointers appreciated - this is making me nuts!

Thanks.


They made DOM a little easier than that...

var el = null;
if (document.getElementById)
el = document.getElementById('box_id');
else if (document.all)
el = document.all['box_id'];
if (el && el.focus)
el.focus();

Make sure to wait till the page is fully loaded.

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.