传递数据而不提交/输入 [英] Passing Data without Submit/Input
问题描述
我想让用户选择一些菜单项,并将它们传递到URL中的
(PHP)页面,而不是提交。按钮。我试过了这个,但是它不起作用:
< a href =" pagetwo.php?say = meaning">< ; img src =" smiley.gif">< / a>
从下拉菜单中选择一个:
< p>
< form>
< select name =含义>
< option> Dopey
< option> ; Sneezey
<选项> Grumpy
< / select>
< / form>
I want to get the user''s choice of some menu items, and pass them to a
(PHP) page in the URL, rather than with "Submit" button. I tried
this, but it doesn''t work:
<a href="pagetwo.php?says=meaning"><img src="smiley.gif"></a>
Pick one from drop-down menu:
<p>
<form>
<select name=meaning>
<option>Dopey
<option>Sneezey
<option>Grumpy
</select>
</form>
推荐答案
" Ben Sharvy" <峰; bs ***** @ mac.com>在消息中写道
news:d1 ************************** @ posting.google.c om ...
"Ben Sharvy" <bs*****@mac.com> wrote in message
news:d1**************************@posting.google.c om...
我想让用户选择一些菜单项,并将它们传递到URL中的
(PHP)页面,而不是提交。按钮。我试过这个,但它不起作用:
< a href =" pagetwo.php?say =含义">< img src ="笑脸。 GIF">< / A>
替换为:
< script type =" text / javascript">
document.write('' < a
onclick =" document.forms [''myForm'']。submit();">< img src =" smiley.gif">< / a>'');
< / script>
使用脚本编写此链接,因为如果Javascript支持不可用
或关闭然后链接无论如何都不会工作。在这种情况下,它在NOSCRIPT元素中替换下面的
,通过提交按钮,你试图避免
避免。
<从下拉菜单中选择一个:
< p>
< form>
替换为:
< form id =" myForm"行动= QUOT; pagetwo.php" method =" get">
< select name =含义>
<选项> Dopey
<选项> Sneezey
<选项> Grumpy
< / select>
插入:
< noscript>
< input type =" submit"命名= [提交" value =" Submit">
< / noscript>
< / form>
I want to get the user''s choice of some menu items, and pass them to a
(PHP) page in the URL, rather than with "Submit" button. I tried
this, but it doesn''t work:
<a href="pagetwo.php?says=meaning"><img src="smiley.gif"></a>
Replace with:
<script type="text/javascript">
document.write (''<a
onclick="document.forms[''myForm''].submit();"><img src="smiley.gif"></a>'');
</script>
Use script to write this link, because if Javascript support is unavailable
or turned off then the link wouldn''t work anyway. In that case, it''s replace
below, inside a NOSCRIPT element, by the Submit button that you''re trying to
avoid.
Pick one from drop-down menu:
<p>
<form>
Replace with:
<form id="myForm" action="pagetwo.php" method="get">
<select name=meaning>
<option>Dopey
<option>Sneezey
<option>Grumpy
</select>
Insert:
<noscript>
<input type="submit" name="submit" value="Submit">
</noscript>
</form>
没有javascript就没有办法吗?
Isn''t there a way to do it without javascript?
bs ***** @ mac.com (Ben Sharvy)写道:
bs*****@mac.com (Ben Sharvy) wrote:
如果没有javascript,有没有办法做到这一点?
Isn''t there a way to do it without javascript?
No.
-
Harlan Messinger
删除我的电子邮件地址中的第一个点。
Veuillez?ter le premier point de mon adresse de courriel。
No.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ?ter le premier point de mon adresse de courriel.
这篇关于传递数据而不提交/输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!