| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 765 人关注过本帖
标题:请问一个传值问题
只看楼主 加入收藏
s6gy
Rank: 1
等 级:新手上路
帖 子:330
专家分:0
注 册:2006-10-26
收藏
 问题点数:0 回复次数:0 
请问一个传值问题

下面这个可以传过去
<script language="javascript" type="text/javascript">function submitbutton_reg() {
var form = document.mosForm;
var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i");
//shengguoyou
// do field validation
//if (form.name.value == "") {
// alert( "<?php echo addslashes( html_entity_decode(_REGWARN_NAME) );?>" );
//} else
if (form.username.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_UNAME) );?>" );
} else if (r.exec(form.username.value) || form.username.value.length < 3) {
alert( "<?php printf( addslashes( html_entity_decode(_VALID_AZ09_USER) ), addslashes( html_entity_decode(_PROMPT_UNAME) ), 2 );?>" );
}
//else if (form.idcard.value == "") {
//alert( "<?php echo addslashes( html_entity_decode(_REGWARN_IDCARD) );?>" );
//}



else if (form.email.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_MAIL) );?>" );
} else if (form.password.value.length < 6) {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_PASS) );?>" );
} else if (form.password2.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_VPASS1) );?>" );
} else if ((form.password.value != "") && (form.password.value != form.password2.value)){
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_VPASS2) );?>" );
} else if (r.exec(form.password.value)) {
alert( "<?php printf( addslashes( html_entity_decode(_VALID_AZ09) ), addslashes( html_entity_decode(_REGISTER_PASS) ), 6 );?>" );
}

//shengguoyou add
else if (form.question.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_QUESTION) );?>" );
}
else if (form.answer.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_ANSWER) );?>" );
}
else {
form.submit();
}
}
</script>
<form action="index.php" method="post" name="mosForm">
<?php $idcard=$_POST['idcard'];
$name=$_POST['name']
?>
<div class="componentheading">
<?php echo _REGISTER_TITLE; ?>
</div>
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
<tr>
<td colspan="2"><?php echo _REGISTER_REQUIRED; ?></td>
</tr>
<tr>
<td><?php echo _REGISTER_NAME; ?> * </td>
<td><input name="name" type="text" class="inputbox" id="name" value="<?php echo "$name"?>" size="40" maxlength="50" /></td>
</tr>
<tr>
<td><?php echo _REGISTER_IDCARD; ?> *</td>
<td><input name="idcard" type="text" class="inputbox" id="idcard" value="<?php echo "$idcard"?>" size="40" maxlength="100" /></td>
</tr>
<tr>
<td width="30%">
<?php echo _REGISTER_UNAME; ?> * </td>
<td>
<input type="text" name="username" size="40" value="" class="inputbox" maxlength="25" /> </td>
</tr>
<tr>
<td>
<?php echo _REGISTER_EMAIL; ?> * </td>
<td>
<input type="text" name="email" size="40" value="" class="inputbox" maxlength="100" /> </td>
</tr>
<tr>
<td><?php echo _REGISTER_PASS; ?> * </td>
<td><input class="inputbox" type="password" name="password" size="42" value="" /> </td>
</tr>
<tr>
<td><?php echo _REGISTER_VPASS; ?> * </td>
<td><input class="inputbox" type="password" name="password2" size="42" value="" /> </td>
</tr>
<tr>
<td><?php echo _REGISTER_QUESTION; ?> *</td>
<td><input name="question" type="text" class="inputbox" value="" size="40" maxlength="100" />
<?php echo _REGISTER_QUESTION1; ?></td>
</tr>
<tr>
<td><?php echo _REGISTER_ANSWER; ?> *</td>
<td><input name="answer" type="text" class="inputbox" value="" size="40" maxlength="100" />
<?php echo _REGISTER_ANSWER1; ?></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan=2> </td>
</tr>
</table>
<input type="hidden" name="id" value="0" />
<input type="hidden" name="gid" value="0" />
<input type="hidden" name="useractivation" value="<?php echo $useractivation;?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="task" value="saveRegistration" />
<input name="button" type="button" class="button" value="<?php echo _BUTTON_SEND_REG; ?>" />
<input type="hidden" name="<?php echo $validate; ?>" value="1" />
</form>

在同一页面 通过函数判断 这个为什么传不过去 <script language="javascript" type="text/javascript">function ChkFields() {
var form = document.myform;
var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i");
// do field validation
if (form.name.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_NAME) );?>" );
} else
if (form.idcard.value == "") {
alert( "<?php echo addslashes( html_entity_decode(_REGWARN_IDCARD) );?>" );
}
else {
form.submit();
}
}
</script>
<form action="index.php" method="post" name="myform" id="myform" >
<div class="componentheading"></div>
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane">
<tr>
<td><?php echo _REGISTER_NAME; ?> * </td>
<td><input name="name" type="text" class="inputbox" id="name" size="40" maxlength="50" /></td>
</tr>
<tr>
<td><?php echo _REGISTER_IDCARD; ?> *</td>
<td><input name="idcard" type="text" class="inputbox" id="idcard" size="40" maxlength="100" /></td>
</tr>

</table>
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="saveRegistration1" />
<input type="button" value="<?php echo _BUTTON_SEND_PASS1; ?>" class="button" />
<input type="hidden" name="<?php echo $validate; ?>" value="1" />
</form>

搜索更多相关主题的帖子: 传值 
2007-01-22 16:08
快速回复:请问一个传值问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.059384 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved