通过javascript获取iframe里的值示例代码

复制代码 代码如下:

  <script type="text/javascript" language="javascript">

  function CCCC(){

  var File_NAME="";

  var count=0;

  if(document.frames("myFrame").document.all.length){

  for(var i=0;i<document.all.length;i++){

  if(document.frames("myFrame").document.all(i).type == 'checkbox' && document.frames("myFrame").document.all(i).checked== true) {

  File_NAME=document.frames("myFrame").document.all(i).value;

  alert(File_NAME);

  count++;

  }

  }

  }

  if(count==1){

  var url="<%=path%>/AttSSSS?File_NAME="+File_NAME;

  var returnValue=showModalDialog(url,"AttSSSS","dialogWidth:700px;dialogHeight:500px;dialogLeft:400px;dialogTop:200px;center:yes;help:yes;resizable:yes;status:yes");

  if(returnValue){

  window.location.href= window.location.href;

  }

  }

  else if(count<1){

  alert('您还没有选择信息,请在需要选择的条目点击鼠标!');

  }

  else{

  alert('每次只能选择一条信息!');

  }

  }

  </script>