开发者

Submitting a form using JavaScript and image maps

开发者 https://www.devze.com 2022-12-12 01:24 出处:网络
I have a issue, I have a form called quicksearch CODE <form method=\"GET\" name=\"quicksearch\" act开发者_JAVA百科ion=\"search_results.php\">

I have a issue, I have a form called quicksearch

CODE

<form method="GET" name="quicksearch" act开发者_JAVA百科ion="search_results.php">

            <input name="search" type="text" id="search" size="50" value="<?=@$_REQUEST['search']?>">

        </form>

The submit button is an image map

and looks as follows

<img src="images/header_16.jpg" alt="" width="111" height="42" border="0" usemap="#Map3">

How can I submit this using javascript, I have the following but it fails everytime and does nothing.

<map name="Map3">

  <area shape="rect" coords="2,4,109,39" href="javascript:document.quicksearch.submit();">

</map>


Try using:

document.forms[0].submit();

This should submit the first form on the page.

Or even give the form an id and use this:

document.getElementById('formID').submit();
0

精彩评论

暂无评论...
验证码 换一张
取 消