手记

jquery iframe弹出多选框

         多选框的应用
父页
<div id="goodlist3" style = "width:550px;height:460px;margin:0 auto;display:none;position:absolute;background-color:#fff;Z-INDEX:4;">
 <div id="areamovetop" class="top">
  <div class="title"><span><b>请选择物品</b></span><span id="close" onclick = "getChooseArea()" >关闭</span></div>
 </div>
 <div>
  <iframe name="good3Iframe" id="good3Iframe" src = "index.php?a=task&cp=goodlist3" width="550px;" height="460px;">
  </iframe>
 </div>
</div>
父页中相关的jsfunction acceptClose()
{
 $("#acceptdialoge").css("display","none");
}
function acceptChoose()
{
 var data = '';
 var a = frames[ "acceptIframe"].document.getElementsByName( "did"); //获取子页面的值
 for(var   i=0;   i <a.length;   i++)
 {
  if(a[i].checked)
  {
   //alert(a[i].value);
   data += a[i].value + ',';
  }
 }
 if(data)
 {
  data = data.substr(0,data.length-1);//去掉最后一个逗号
 }
 $("#com3").attr("value",data);
 $("#acceptdialoge").css("display","none");
}子页中相关代码:
<div id="areamove">
<form name="search" method="post" action="index.php?a=task&cp=com1dialoge"> 
 <div id='choosediv'>
  <b >请输入对话ID:</b>
  <input type="text" name="keyword" value="{$keyword}">
  <input type="submit" name="submit" value="搜索">
  <span onclick="parent.acceptChoose()">确定:</span>  //调用父页中的js
 </div>
</form> 
{if $list}
 <div ></div>
 
 <div id="top">
   <ul>
    <li ><span class='diaid'>对话编号</span><span>npc对话</span></li>
   </ul>   
 </div>
 <ul>
  {loop $list $dialoge}
      <li><span class='diaid'><input type='checkbox' name='did[]' id='did' value="{$dialoge['d_id']}">{$dialoge['d_id']}</span> <span>{$dialoge['dialogue_npc']}</span></li>
  {/loop}
 </ul>
 <div id="clear"></div> 
 <div id="page">
    <div><b >$multipage</b></div>
 </div>
{/if}
</div>

0人推荐
随时随地看视频
慕课网APP