用js从一个框架(frame)调用另一个框架(frame)的内容

用js从一个框架(frame)调用另一个框架(frame)的内容

1.frame.html

 

< frameset  id ="fr"  rows ="50%,50%" >
      
< frame  name ="up"  id ="up"  src ="u.html" />
      
< frame  name ="down"  id ="down"  src ="d.html" />
</ frame >

 


2.u.html

 

代码
< html >
< head >
< script >
function  test()
{
  
var  objValue = window.parent.frames[ " down " ].document.getElementById( " 456 " );
  alert(objValue.value);
}

</ script >
</ head >
< body >
< input  id ="123"  type ="button"  value =" 测 试 "  onclick ="test();" />
</ body >
</ html >

 


3.d.html

 

< html >
< head >
</ head >
< body >
  < input  id ="456"  type ="text"  value ="456" />
</ body >
</ html >

 

 

你可能感兴趣的:(frame)