Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:17

Placing cursor into search field


Poster: shacker
Dated: Monday January 23 2006 - 23:46:47 GMT

I've got a drop-down Search field in a Milonic menu, which is working nicely.

http://dev.journalism.berkeley.edu/alumni/

I'm trying to configure it so that the cursor is placed automatically in the search field when the Search item is selected. I know how to do this in the BODY tag when the field is already part of the page:

onLoad="self.focus();document.contacts.SearchTerm.focus()"

but how can I do it when it's part of a menu item? Is it even possible? I notice that Milonic don't even do this with their own Search menu item, so maybe it's not...

Thanks,
scot


Poster: Ruth
Dated: Tuesday January 24 2006 - 0:45:00 GMT

Hi,

It's been done. From Andy,

You could do it with a setTimeout function, something like this:

Code:
<script>
function setFocus()
{
setTimeout("document.forms.search.q.focus()",100);
}
</script>

Assuming a form object named "search" and a text box called "q"


Called from the parent menu item with an onfunction embedded inside the aI string, like this:

Code:
aI("url=/search.php;text=Search;showmenu=mm search;onfunction=setFocus()")


One thing to keep in mind, check your overfilter if you have it set. If anything, for example let's say you are using fade, if the duration is set to more than what you set as the time in the setTimeout, you need to increase the set time out so that the menu is fully loaded before the setTimeout fires.

Ruth


Poster: shacker
Dated: Tuesday January 24 2006 - 1:11:38 GMT

Bingo, that works! Many thanks Ruth.