ie7下无法提交表单,ie6下面却能正常提交,这是怎么回事、

美人心计1999 2010-08-09 03:25:43
ie7是可以验证的,如果不填数据直接提交是会验证的,但数据填完了再点击提交就毫无反应....谁碰到过这种情况....恼人...
...全文
207 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
woshimajia0003 2010-08-09
  • 打赏
  • 举报
回复
你看一下再ie7下点击按钮后,到底触发了什么事件
phper_cd 2010-08-09
  • 打赏
  • 举报
回复
想验证的时候最好写在form里面 onsubmit = "return formCheck()"

最后formCheck应该有一个返回值
美人心计1999 2010-08-09
  • 打赏
  • 举报
回复
----对应的js文件---

function generalConfirmForm(){

var tips = $$('span.tipspan');
tips.each(function(tip, i) {
$(tip).style.display = 'none';
});
var tips = $$('td.tipspan');
tips.each(function(tip, i) {
$(tip).style.display = 'none';
});
var lis = $$('li.tipspan');
lis.each(function(tip, i) {
$(tip).style.display = 'none';
});
var tips = $$('tr.tipspan');
tips.each(function(tip, i) {
$(tip).style.display = 'none';
});


var radios = $$('#info input[type=radio]');
radios.each(function(radio, i) {
if($(radio).getProperty('checked')){
var tmp = $(radio).value;
var name = $(radio).getProperty('name');
new Element('input',{'class':'confirmspan','type':'hidden','value':tmp,'name':name}).injectAfter(radio);

}else{
var id = $(radio).getProperty('id');
var labe = 'label_'+id;
if($(labe)) $(labe).style.display='none';
}
$(radio).setProperty('disabled','disabled');
$(radio).style.display='none';
});
var checkboxs = $$('#info input[type=checkbox]');
checkboxs.each(function(checkbox, i) {
if($(checkbox).getProperty('checked')){
var tmp = $(checkbox).value;
var name = $(checkbox).getProperty('name');
new Element('input',{'class':'confirmspan','type':'hidden','value':tmp,'name':name}).injectAfter(checkbox);
}else{
var id = $(checkbox).getProperty('id');
var labe = 'label_'+id;
if($(labe)) $(labe).style.display='none';
}
$(checkbox).setProperty('disabled','disabled');
$(checkbox).style.display='none';
});

var inputs = $$('#info input[type=text]');
inputs.each(function(input, i) {
$(input).style.display = 'none';
if($(input).value){
var tmp = filters($(input).value);
new Element('span',{'class':'confirmspan'}).setHTML(tmp).injectBefore(input);
}
});
var textareas = $$('#info textarea');
textareas.each(function(textarea, i) {
$(textarea).style.display = 'none';
if($(textarea).value){
var tmp = filters($(textarea).value);
tmp=tmp.replace( /\n/g,'<BR/>');
new Element('span',{'class':'confirmspan'}).setHTML(tmp).injectAfter(textarea);
}
});
var passwords = $$('#info input[type=password]');
passwords.each(function(password, i) {
$(password).style.display = 'none';
if($(password).value){
var tmp = '********';
new Element('span',{'class':'confirmspan'}).setHTML(tmp).injectBefore(password);
}
});
var selects = $$('#info select');
selects.each(function(select, i) {
$(select).style.display = 'none';
if($(select).value){
var tmp = $(select).options[$(select).options.selectedIndex].text;
new Element('span',{'class':'confirmspan'}).setHTML(tmp).injectBefore(select);
}
});



}

function formSubmit()
{


var isOK = $('isOK').value;
if(isOK!=1)
{
var check = formCheck();
if(!check) return;
if(confirm("请确认输入信息的正确性?\r\n入力内容に間違いはありませんか?"))
{
document.info.submit();
}
}
else
{
if(confirm("请确认输入信息的正确性?\r\n入力内容に間違いはありませんか?"))
{
document.info.submit();
}
}

}

function formCheck()
{
$('errors').innerHTML = '';
$('errors').style.display = 'none';
var errors = new Array;

var value= document.info.userName.value;

if(!value)
{
errors.push('姓名必须输入/姓名を入力してください。');
}
var value=document.info.address.value;
if(!value)
{
errors.push('地址必须输入/住所を入力してください。');
}
var value= document.info.tel.value;
if(!value)
{
errors.push('电话号码必须输入/電話番号を入力してください。');
}
if(value){
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value)){
errors.push('电话号码必须是数字/電話番号は数字で入力してください');
}
}
var value=document.info.youbian.value;
if(value){
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value)){
errors.push('邮编必须是数字/郵便番号は数字で入力してください');
}
}

var value= document.info.email.value;
if(value)
{
var reg = /^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i;
var check1 = reg.exec(value);
if(!check1)
{
errors.push('邮件地址格式错误/電子メールの入力形式が正しくありません');
}
}
var value=document.info.p1.value;
if(value=="0"){
errors.push("希望商品1必须选择/希望商品1を入力してください。");
}
var value=document.info.p1_count.value;
if(value=="0"){
errors.push("希望商品1个数必须选择/希望商品1個数を入力してください。");
}

var value1=document.info.birthday_year.value;
var value2=document.info.birthday_month.value;
var value3=document.info.birthday_day.value;
if(value1){
con1=false;
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value1)){
errors.push('生日年必须是数字/誕生日・年は数字で入力してください');
}
}
if(value2){
con2=false;
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value2)){
errors.push('生日月必须是数字/誕生日・月は数字で入力してください');
}
}
if(value3){
con3=false;
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value3)){
errors.push('生日日必须是数字/誕生日・日は数字で入力してください');
}
}
if(value1==""&&value2==""&&value3==""){}
else{
if(value1&&value2&&value3){}
else{
errors.push("生日必须完整/誕生日年月日を完了する必要があります");
}
}
var value1=document.info.year.value;
var value2=document.info.month.value;
var value3=document.info.day.value;
var value4=document.info.xiaoshi.value;
if(value1){
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value1)){
errors.push('希望收货日期年必须是数字/希望配送日・年は数字で入力してください');
}
}
if(value2){
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value2)){
errors.push('希望收货日期月必须是数字/希望配送日・月は数字で入力してください');
}
}
if(value3){
var re = /^[0-9]+.?[0-9]*$/;
if(!re.test(value3)){
errors.push('希望收货日期日必须是数字/希望配送日・日は数字で入力してください');
}
}
if(value1==""&&value2==""&&value3==""){}else{
if(value1&&value2&&value3){}
else{
errors.push("希望收货日期年月日必须完整/希望配送日年月日を完了する必要があります");
}
}
var value= document.info.beizhu.value;

if(value)
{
reg = new RegExp("^[\\s\\S]{0,500}$");
var check1 = reg.test(value);
if(!check1){
errors.push('备注不能超过500个字/備考は500文字以内で入力してください');
}
}
if(errors.length<1)
{
$('isOK').value=1;
hideDiv();
return true;
}

var str = '';
for(i=0;i<errors.length;i++)
{
str = str+errors[i]+'<br/>';
}

$('errors').innerHTML = str;
$('errors').style.display = '';
$('isOK').value = '';
window.scroll(0,547);

return false;
}

function showDiv(){
var hides = $$('.step2');
for (i=0;i<hides.length;i++){
hides[i].style.display = 'none';
}

var shows = $$('.step1');
for (i=0;i<shows.length;i++){
shows[i].style.display = '';
}

window.scroll(0,0);
}

function hideDiv(){
var hides = $$('.step2');
for (i=0;i<hides.length;i++){
hides[i].style.display = '';
}

var shows = $$('.step1');
for (i=0;i<shows.length;i++){
shows[i].style.display = 'none';
}

//window.scroll(0,0);
}


function formBack(){
showDiv();
$('isOK').value='';
generalBackForm();
}

function generalBackForm(){
var tips = $$('span.tipspan');
tips.each(function(tip, i) {
$(tip).style.display = '';
});
var tips = $$('td.tipspan');
tips.each(function(tip, i) {
$(tip).style.display = '';
});
var tips = $$('tr.tipspan');
tips.each(function(tip, i) {
$(tip).style.display = '';
});
var radios = $$('#contact_form input[type=radio]');
radios.each(function(radio, i) {
$(radio).removeAttribute('disabled');
$(radio).style.display='';
var id = $(radio).getProperty('id');
var labe = 'label_'+id;
$(labe).style.display='';
});
var checkboxs = $$('#contact_form input[type=checkbox]');
checkboxs.each(function(checkbox, i) {
$(checkbox).removeAttribute('disabled');
$(checkbox).style.display='';
var id = $(checkbox).getProperty('id');
var labe = 'label_'+id;
$(labe).style.display='';
});
var inputs = $$('#contact_form input[type=text]');
inputs.each(function(input, i) {
$(input).style.display = '';
});
var textareas = $$('#contact_form textarea');
textareas.each(function(textarea, i) {
$(textarea).style.display = '';
});
var passwords = $$('#contact_form input[type=password]');
passwords.each(function(password, i) {
$(password).style.display = '';
});
var selects = $$('#contact_form select');
selects.each(function(select, i) {
$(select).style.display = '';
});
var confirmspans = $$('span.confirmspan');
confirmspans.each(function(span, i) {
$(span).remove();
});
var confirmspans = $$('input.confirmspan');
confirmspans.each(function(span, i) {
$(span).remove();
});
var advertisementCheckboxDiv = $('advertisementCheckboxDiv');
if(advertisementCheckboxDiv){
advertisementCheckboxDiv.removeClass('advertisementCheckboxDiv');
}
}

function filters(value)
{
value = value.replace(/\>/g,">");
value = value.replace(/\</g,"<");

return value;
}
美人心计1999 2010-08-09
  • 打赏
  • 举报
回复
---------页面---

<?php
defined('_JEXEC') or die('Restricted access');
?>
<style type="text/css">
.error{color:#FF312D; background:url(../images/contact/error.jpg) no-repeat 0px 4px; padding-left:20px;}
#info_table .data4{height:20px;width:auto;}
</style>
<meta charset="utf-8" />
<script language="javascript" src="media/system/js/mootools.js"></script>
<script language="javascript" src="media/system/js/kadoya.js"></script>

<p class="sub_menu">
<span class="sub_mnu1"><a href="index.html">首页</a></span> >
<span class="sub_mnu2">购买纳豆</a>
<!--sub_menu--></p>
<div id="contents">
<div id="nattou_mainimg">
<p><img src="img/index/nagayama_red.jpg" alt="Nagayama" name="nattou_leftimg" width="171" height="187" id="nattou_leftimg" /></p>
<p><img src="img/contact/main_pic_new.jpg" alt="购买纳豆" width="242" height="251" id="nattou_midimg" /></p>
<p><img src="img/index/takura.jpg" alt="Komatsu" width="183" height="219" id="nattou_rightimg" /></p>
<!--nattou_mainimg--></div>
<div class="info_form">
<p class="info_text">真诚感谢您订购我们的冷冻纳豆。为了保证您的信息的正确性,请认真填写下表,再次确认无误后,点击“登录”按键确定订单。
</p>
<p class="japanese info_jptxt">【 この度は弊社の冷凍納豆をご注文いただきまして誠にありがとうございます。下記フォームに必要事項をご記入の上、ページ下部の「登録(登陆)」をクリックしてご注文の確定をお願い致します。】
</p>
<p class="info_text">加“★”的为必填项目。请确认无遗漏后发送订单,谢谢!</p>
<p class="japanese info_jptxt">【 ★印は必須項目になります。お手数ですが漏れなくご記入の上ご注文をお願い致します 】</p>
<div id="errors" class="error"></div>
<form name="info" id="info" method="post" action="index.php?option=<?php echo $this->option;?>&task=<?php echo $this->view;?>">
<input type="hidden" name="isOK" id="isOK" value="" />
<table id="info_table">
<tr>
<th>★ 姓名/姓名</th>
<td><input type="text" maxlength="20" name="userName" value="" class="data1" /></td>
</tr>
<tr>
<th>    邮编/郵便番号</th>
<td><input type="text" maxlength="6" name="youbian" value="" class="data1" /></td>
</tr>
<tr>
<th>★ 地址/住所</th>
<td><input type="text" maxlength="150" name="address" value="" class="data1" /></td>
</tr>
<tr>
<th>★ 电话号码/電話番号</th>
<td><input type="text" maxlength="11" name="tel" value="" class="data1" /></td>
</tr>
<tr>
<th class="sub">生日/誕生日</th>
<td>
<input type="text" name="birthday_year" maxlength="4" value="" class="data2" /> 年
<input type="text" name="birthday_month" maxlength="2" value="" class="data3" /> 月
<input type="text" name="birthday_day" maxlength="2" value="" class="data3" /> 日
</td>
</tr>
<tr>
<th>    邮件地址/<span class="japanese">電子メール</span></th>
<td><input type="text" name="email" value="" class="data1" /></td>
</tr>
<tr>
<th>★ 希望商品1</th>
<td>
<select name="p1" class="data4">
<option selected="selected" value="0">请选择</option>
<?php foreach($this->product1 as $key=>$value){ ?>
<option ><?php echo $value; ?></option>
<?php } ?>
</select> 个数/個数 
<select name="p1_count" class="data4">
<option selected="selected" value="0">请选择</option>
<?php foreach($this->counts as $key=>$value){ ?>
<option value="<?php echo $value; ?>" /><?php echo $value; ?>
<?php } ?>
</select>
</td>
</tr>
<tr>
<th>    希望商品2</th>
<td>
<select name="p2" class="data4">
<option selected="selected" value="0">请选择</option>
<?php foreach($this->product1 as $key=>$value){ ?>
<option value="<?php echo $value; ?>" /><?php echo $value; ?>
<?php } ?>
</select> 个数/個数 
<select name="p2_count" class="data4">
<option selected="selected" value="0">请选择</option>
<?php foreach($this->counts as $key=>$value){ ?>
<option value="<?php echo $value; ?>" /><?php echo $value; ?>
<?php } ?>
</select>
</td>
</tr>
<tr>
<th>    希望商品3</th>
<td>
<select name="p3" class="data4">
<option selected="selected" value="0">请选择</option>
<?php foreach($this->product1 as $key=>$value){ ?>
<option value="<?php echo $value; ?>" /><?php echo $value; ?>
<?php } ?>
</select> 个数/個数 
<select name="p3_count" class="data4">
<option selected="selected" value="0">请选择</option>
<?php foreach($this->counts as $key=>$value){ ?>
<option value="<?php echo $value; ?>" /><?php echo $value; ?>
<?php } ?>
</select>
</td>
</tr>
<tr>
<th>    其他/<span class="japanese">その他</span></th>
<td><input type="text" maxlength="100" name="qita" value="" class="data1" /></td>
</tr>
<tr>
<th class="sub">希望收货日期/希望配送日</th>
<td>
<input type="text" name="year" maxlength="4" value="" class="data2" /> 年
<input type="text" name="month" maxlength="2" value="" class="data3" /> 月
<input type="text" name="day" maxlength="2" value="" class="data3" /> 日
<select name="xiaoshi" class="data4">
<option selected="selected" value="xuanze">请选择</option>
<?php foreach($this->hours as $key=>$value){ ?>
<option value="<?php echo $value; ?>" /><?php echo $value; ?>
<?php } ?>
</select>
</td>
</tr>
<tr>
<th class="sub">备注/備考</th>
<td><textarea name="beizhu"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="button" style="background:url(img/contact/button.jpg);" src="img/contact/button.jpg" onclick="formSubmit();" value="" class="infobut" />
</td>
</tr>
</table>
</form>
</div>
<!--info_form-->
</div>
<?php if(JRequest::getVar("param")!=""&&JRequest::getVar("param")=="finish"){ ?>
<script language="javascript">alert("谢谢您的订购!\r\nご注文ありがとうございました")</script>
<?php } ?>
<!--contents-->
phper_cd 2010-08-09
  • 打赏
  • 举报
回复
至今还没有遇见过,哈哈

你用的JS验证?是不是忘了写return
CunningBoy 2010-08-09
  • 打赏
  • 举报
回复
代码贴出来看看。

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧