Hey Juan,
Few things to change to make it works.
1. <form>
Add onsubmit to the <form> tag, and block the default call using
event.preventDefault(), and then call you function doSearch() ... like
this:
<form name="searchform" onsubmit="event.preventDefault();doSearch();">
2. Remove onsubmit in the <input>.. like this:
<input type="text" name="Search_Term" onkeypress=
"submitenter(event)">
And Now, your code is like this:
<form name="searchform"
onsubmit="event.preventDefault();doSearch();">
<input type="text" name="Search_Term"
onkeypress= "submitenter(event)">
<img name="button" img src = "ball-1.png" width="35"
height="32"align = "middle" value="検索" onClick="doSearch()">
</form>
I tested it and it works. Try~
Costa
On Jul 10, 6:22 pm, jkramlich <[EMAIL PROTECTED]> wrote:
> Try creating a test page that simply alerts the value of keycode so
> you can see if the apple search button has a corresponding value to
> check for.
>
> function submitenter(event)
> {
> var keycode;
> if (window.event) keycode = window.event.keyCode;
> else if (e) keycode = e.which;
> else return true;
>
> alert(keycode);
>
> }
>
> - John Kramlich
>
> On Jul 10, 1:06 am, juan_in_nippon <[EMAIL PROTECTED]> wrote:
>
> > I passing the following form to an Ajax search routine "doSearch()".
>
> > <form name="searchform">
> > <input type="text" name="Search_Term" onsubmit = "return doSearch()"
> > onkeypress= "return submitenter(event)">
> > <img name="button" img src = "spotlight.png" width="35"
> > height="32"align = "middle" value="Find" onClick="doSearch()">
> > </form>
>
> > I am trapping the enter and return key using this function:
>
> > function submitenter(event)
> > {
> > var keycode;
> > if (window.event) keycode = window.event.keyCode;
> > else if (e) keycode = e.which;
> > else return true;
>
> > if (keycode == 13)
> > {
> > doSearch();
> > return false;
> > }
> > else
> > return true;
>
> > }
>
> > My question: how would I alter this function to also handle the
> > keycode from Apple's Search key on the iPhones's virtural keyboard.
>
> > Note that the form does not have a submit button but a plain image
> > button
>
> > The actual demo code is running at this url:http://www.passport-i.com
>
> > Many thanks again for any suggestions!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---