Changing an Iframe src using Javascript

 

 

<script language="javascript">

function LoadPage(){

    var objFrame=document.getElementById("month_frame");

    var curdate = new Date();

    var month = curdate.getMonth();

    objFrame.src=month+".htm";

}

</script>

 

 

 

 

 

 

<script type="text/javascript">

 

 

document.body.onload = date; //event handler (calls the function)

 

 

function date()

{

    var nmonth= getmonth();

    var months = new Array("january.htm", "febuary.htm", etc...);

    window.frames["calendar"].src = months[nmonth];

}

</script>

 

 

Also, I think you may need the name attribute as well for some browsers.

 

 

<iframe name="calendar" id="calendar" src="august.htm" height="300" width="350"></iframe>

 

<body style="margin:0px">
<iframe style="width:100%;height:100%" frameborder=0 src="about:那不就是百分百么?">

相关文章:

  • 2021-11-09
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2021-06-17
  • 2021-12-20
  • 2021-06-22
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案