Rumah > Artikel > pembangunan bahagian belakang > 勾选复选框,点击确定后,将复选框的值分行显示在多行文本框内,怎么弄?
A.php页面:
全选: 您选择了 位 |
{$xy.name} |
在B.php页面里勾选checkboxes[],并点击选择后,怎么在A.php里的receiver_id这个多行文本框里每行显示一个号码,而不是用,号隔开号码??
从 B 怎么回到 A 的 ?
既然你会是用,号隔开。那么把逗号换成换行(chr(10) 或 "\n")不就可以了吗?
这是相关JS
<script> <br /> function checknum_() <br /> { <br /> var num=0; <br /> <br /> $("input[name='checkboxes[]']:checkbox").each(function(){ <br /> //this.checked=!this.checked; <br /> <br /> if(this.checked == true) <br /> { <br /> num=num+1; <br /> } <br /> <br /> }) <br /> $("input[name=sl]").val(num); <br /> //alert(num); <br /> <br /> } <br /> <br /> function insert_() <br /> { <br /> <br /> $("input[name='checkboxes[]']:checkbox").each(function(){ <br /> //this.checked=!this.checked; <br /> <br /> if(this.checked == true) <br /> { <br /> if( $.trim($("textarea[name=receiver_id]",window.opener.document).val()) != "" ) <br /> { <br /> $("textarea[name=receiver_id]",window.opener.document).val( $.trim($("textarea[name=receiver_id]",window.opener.document).val())+"," ); <br /> } <br /> <br /> $("textarea[name=receiver_id]",window.opener.document).val( $.trim($("textarea[name=receiver_id]",window.opener.document).val())+this.value ); <br /> <br /> } <br /> <br /> }) <br /> <br /> window.opener.check_user_sms_post_receiver(); <br /> window.opener.check_user_sms_post_mobile(); <br /> } <br /> </script>
function check_user_sms_post_receiver()
{
var str_receiver_account = $("textarea[name=receiver_id]").val();
str_receiver_account = str_receiver_account.replace(/\n|\r/g,"");
str_receiver_account = str_receiver_account.replace(/\s+/g,"");
var arr_acc = str_receiver_account.split(",").unique();
$("textarea[name=receiver_id]").val(arr_acc);
$("#xzw").html(arr_acc.length);
}
function check_user_sms_post_mobile()
{
var str_mobile = $("textarea[name=receiver_id]").val();
str_mobile = str_mobile.replace(/\n|\r/g,"");
str_mobile = str_mobile.replace(/\s+/g,"");
var arr_acc = str_mobile.split(",").unique();
$("textarea[name=receiver_id]").val(arr_acc);
for(var i=0;i
if(!checkMobile(arr_acc[i]))
{
alert('手机号' + arr_acc[i] + '不正确!');
$("textarea[name=receiver_id]").focus();
return false;
}
}
}
有人会吗?有人会吗?
有人能帮帮忙吗??