Home > Backend Development > PHP Tutorial > 勾选复选框,点击确定后,将复选框的值分行显示在多行文本框内,怎么弄?

勾选复选框,点击确定后,将复选框的值分行显示在多行文本框内,怎么弄?

WBOY
Release: 2016-06-23 13:51:18
Original
1931 people have browsed it

A.php页面:


                   
                  接收人帐号:
                  
                    

                    群发时一个号码一行

                  
  
  

您选择了0
                


点击A页面的“选择我的学员”后进入到B.php页面:
 
    
      
    
  
全选:
        
        
        您选择了
        
        位

  
    
    {foreach from=$xueyuan_list item=xy name=xy_name}
    {if $smarty.foreach.xy_name.iteration > 1 and ($smarty.foreach.xy_name.iteration-1) % 15 eq 0}
      
      {/if}
      
    {/foreach}
  

        {$xy.name}


在B.php页面里勾选Bcheckboxes[],并点击选择后,怎么在A.php里的checkbox2这个多行文本框里每行显示一个号码,而不是用,号隔开号码??


回复讨论(解决方案)

在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;
}
}

}

有人会吗?有人会吗?

有人能帮帮忙吗??

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template