Help required on setting focus on a menu form item

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
himred
Beginner
Beginner
Posts: 4
Joined: Tue Dec 19, 2006 9:59 pm

Help required on setting focus on a menu form item

Post by himred »

Hi !

on my web site http://www.l2wh.com i use milonic menus (framed version) and everything works great .

If you select the 'FastSearch' item of the top menu of the site,you'll get a simple formular with a text field .

Now, I'm trying to set the focus to that text field when the menu is opened .

I tryed onfunction,clickfuntion with something similar to top.document.getelementbyid["q"].focus(); but that does not seems to work .

Any help is welcome .

Thanks !

Himred
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

This should do it

Code: Select all

function mmVisFunction(_mD,v){
	if(_m[_mD][1]=="search")_d.forms['fs'].q.focus()
}
What you need to do is put this inside the framemenu.js file, probably best just before the search menu like this:

Code: Select all

function mmVisFunction(_mD,v){
	if(_m[_mD][1]=="search")_d.forms['fs'].q.focus()
}

with(milonic=new menuname("search")){
style=SearchStyle;
margin=0;
border=0;
bordercolor="#331155";
aI("text=<FORM METHOD=GET ACTION=/woogle.php name=fs><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td align=center><b>Fast L2WH Search</b><br><br><input id=q name=q type=text><br><br><input type=submit value=Search></td></tr></table></form>>;type=form;align=center;onbgcolor=;onborder=;");
}

HTH,
Andy
himred
Beginner
Beginner
Posts: 4
Joined: Tue Dec 19, 2006 9:59 pm

Post by himred »

Thanks a lot Andy , you are very efficient as usual .

It's done and working .

I won't ask you why this is working ;)

Best regards,

Himred
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

I won't ask you why this is working
It's a little bit of voodoo 8)

Glad you got it working

Cheers,
Andy
Post Reply