i got question about java script.
i got a page contain few of button and list menu. i hope that when i mouseover or change the list menu. the focus will be change to the button beside the list menu. so when press enter, it will not press the first button.
anyone can give me some comment ?
thank u
onclick or onmouseover will change focus to...
Moderator: General Moderators
When I read that, I picture a dropdown menu, and a button beside it. When the user selects something from the dropdown menu, you want the button to become active, so the user can press [Enter] and submit the form? Try something like this:
Code: Select all
<form name=form1 action=script.php method=GET>
<select name=dropdown_menu onchange="document.form1.button1.focus();">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<input type=submit name=button1 value="Go">
</form>thank a lot .... i solve the problem...
but one thing is " document.form1.button1.focus();" , it make focus on the button1 , right. is it the ID will affect the action.
i mean
<input name="supplierbtn" type="submit" id="supplierbtn" value="List">
<input name="customerbtn" type="submit" id="supplierbtn" value="List">
if ID is same name, java script error will occur
but one thing is " document.form1.button1.focus();" , it make focus on the button1 , right. is it the ID will affect the action.
i mean
<input name="supplierbtn" type="submit" id="supplierbtn" value="List">
<input name="customerbtn" type="submit" id="supplierbtn" value="List">
if ID is same name, java script error will occur
id
The only problem will occur if you try to use javaScripts getElementById() as you have to items with the same Id this will confuse javaScript.
But if you are not using getElementById then no worries.
phpScott
But if you are not using getElementById then no worries.
phpScott