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
			
			
									
						
										
						Placing cursor into search field
Hi,
It's been done. From Andy,
You could do it with a setTimeout function, something like this:
 
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:
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
			
			
									
						
										
						It's been done. From Andy,
You could do it with a setTimeout function, something like this:
Code: Select all
<script> 
function setFocus() 
{ 
setTimeout("document.forms.search.q.focus()",100); 
} 
</script>Called from the parent menu item with an onfunction embedded inside the aI string, like this:
Code: Select all
aI("url=/search.php;text=Search;showmenu=mm search;onfunction=setFocus()")Ruth

