w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: HTML DOM srcÊôÐÔ
The src property sets or returns the URL of the document that should be loaded into the frame.
srcÊôÐÔ¿ÉÒÔÉèÖûò·µ»ØÓ¦¼ÓÔØ½ø¿ò¼ÜÀïµÄÎĵµURL
frameObject.src=URL |
In our example we will first create an HTML document containing a frameset with two columns. Each column is set to 50% of the browser window:
¾ÙÀýÖÐÎÒÃǽ¨Á¢ÁËÒ»¸ö°üº¬Á½¸öÁеĿò¼ÜHTMLÎĵµ£¬Ã¿¸öÁеĿí¶ÈΪÕû¸öä¯ÀÀÆ÷´°¿Ú×ܶζȵÄ50%:
<html>
<frameset cols="50%,50%">
<frame id="lFrame" src="frame_src.htm">
<frame id="rFrame" src="frame_a.htm">
</frameset>
</html>
|
The HTML document "frame_src.htm" is put into the first column, and the HTML document "frame_a.htm" is put into the second column.
"frame_src.htm"·ÅÖÃÔÚµÚÒ»¸öÁÐÖУ¬"frame_a.htm"ÔòÔÚµÚ¶þ¸öÁÐ
The source of "frame_src.htm" is as follows:
"frame_src.htm"µÄ´úÂëÈçÏ£º
<html>
<head>
<script type="text/javascript">
function newSrc()
{
parent.document.getElementById("lFrame").src="http://w3schools.com"
parent.document.getElementById("rFrame").src="http://google.com"
}
</script>
</head>
<body> <form> <input type="button" onclick="newSrc()" value="Change frame source" /> </form> </body> </html> |
Change the source of two frames
¸Ä±äÁ½¸ö¿ò¼ÜµÄÀ´Ô´µØÖ·
ÆÀÂÛ (0)
All