有人可以看看他们是否知道我的表单代码无效的原因。它在我的网站上显示正常,但当我按提交时不会发生任何事情。我想知道我的表格中是否有遗漏的东西?
<form method="post" name="CForm" action="form.php" onsubmit="return ValidateCForm();">
<div class="fieldHolder">
<input class="textInput" type="text" name="name" size="20" value="Name" onfocus=" if (this.value == 'Name' ) { this.value = ''; }" onblur="if (this.value == '') { this.value='Name';} ">
</div>
<div class="fieldHolder">
<input class="textInput" type="text" name="email" size="20" value="Email" onfocus=" if (this.value == 'Email' ) this.value = ''; }" onblur="if (this.value == '') { this.value='Email';} ">
</div>
<div class="fieldHolder">
<input class="textInput" type="text" name="Phone" size="20" value="Phone" onfocus=" if (this.value == 'Phone' ) { this.value = ''; }" onblur="if (this.value == '') { this.value='Phone';} ">
</div>
<div class="fieldHolder">
<textarea class="textarea" name="comments" id="textarea-field" onfocus=" if (this.value == 'How can we help you?') { this.value = ''; }" onblur="if (this.value == '') { this.value='How can we help you?';} ">How can we help you?</textarea>
</div>
<div class="code floatleft">Security Question :</div> <div class="code floatleft">3 + 10 = ?</div>
<div class="fieldHolder">
<input class="textInput" id="security_code" name="security_code" type="text" value="Enter Answer" onfocus=" if (this.value == 'Enter Answer' ) { this.value = ''; }" onblur="if (this.value == '') { this.value='Enter Answer';} "><br>
</div>
<input type="hidden" name="formname" value="13">
<input type="submit" class="expand radius" name="Submit" value="Submit" alt="Submit">
</form>
答案 0 :(得分:0)
此行缺少一个起始括号:
<input class="textInput" type="text" name="email" size="20" value="Email" onfocus=" if (this.value == 'Email' ) this.value = ''; }" onblur="if (this.value == '') { this.value='Email';} ">
在此区域:if (this.value == 'Email' ) this.value = ''; }
将其更改为:
<input class="textInput" type="text" name="email" size="20" value="Email" onfocus=" if (this.value == 'Email' ) { this.value = ''; }" onblur="if (this.value == '') { this.value='Email';} ">