gpt4 book ai didi

javascript - 表单提交按钮值

转载 作者:行者123 更新时间:2023-12-03 10:33:06 24 4
gpt4 key购买 nike

<form action="mail.php" method="post" id="myform" name="myform" onsubmit="javascript:return validForm(document.myform)">
<input type="submit" class=" " name='btnanother' id='btnanother' value='asdf'>
<input type="text" class="txtinput" name="fname" id="fname" value="First &amp; Last Name" onblur="if(this.value==''){this.value='First &amp; Last Name'}" onfocus="if(this.value=='First &amp; Last Name'){this.value=''}">

<input type="text" class="txtinput" name="phone" id="phone" value="Phone" onblur="if(this.value==''){this.value='Phone'}" onfocus="if(this.value=='Phone'){this.value=''}">

<input type="text" class="txtinput" name="email" id="email" value="Email Address" onblur="if(this.value==''){this.value='Email Address'}" onfocus="if(this.value=='Email Address'){this.value=''}">

<input type="text" class="txtinput" name="location" id="location" value="Location" onblur="if(this.value==''){this.value='Location'}" onfocus="if(this.value=='Location'){this.value=''}">

<input type="text" class="txtinput" name="sqrfoot" id="sqrfoot" value="Square Foot of Basement" onblur="if(this.value==''){this.value='Square Foot of Basement'}" onfocus="if(this.value=='Square Foot of Basement'){this.value=''}">

<textarea name="describe" class="txtarea" id="describe" onblur="if(this.value==''){this.value='Describe your basement project'}" onfocus="if(this.value=='Describe your basement project'){this.value=''}">Describe your basement project</textarea>

<div class="banner_captcha">
<div class="banner_captcha_img">
<img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg'>
</div>
<div class="banner_captcha_txt">
<label for='message'>Enter the code here :</label>
<br>
<input id="letters_code" name="letters_code" type="text" value="">
</div>
</div>
<br>
<small>Can't read the image? click <a href='javascript: refreshCaptcha();'>here</a> to refresh</small>

<div class="align-center">
<input type="submit" class=" " name='btnanother' value='submit' style="text-indent:0px;" />
<input type="submit" class=" " name='asfdas' value="asdfasdf" style="text-indent:0px;" />
<input type="submit" class="submit" name='btnSubmit' value="asdf" style="text-indent:0px;" />

</div>

在 mail.php 上未获取提交按钮值。

如果我禁用了 javascript,那么我会得到所有提交按钮的值

最佳答案

在您的代码中调用

document.myform.submit();

当您以这种方式触发表单提交时,您将不会获得提交按钮。

关于javascript - 表单提交按钮值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29123989/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com