使用以前的WordPress版本,我曾使用以下代码自动刷新帖子中的iframe:
<iframe id='feuille1' src="http://competition.hockeyfrance.com/la/ffhgsheet.php?GameID=20094" width="650" height="1000" name='feuille1' ></iframe>
<script type="text/javascript"> function refreshiframe() { document.getElementById('feuille1').src="http://competition.hockeyfrance.com/la/ffhgsheet.php?GameID=20094" setTimeout("refreshiframe()",30000); } </script>
<body onload="refreshiframe();">
使用短代码将代码嵌入到帖子中。这很好,直到最近的3.5更新,我理解包括更新版本的jQuery。
有人可以帮助我理解为什么这个非常简单的代码不再起作用了吗?我该怎么做才能解决它?
答案 0 :(得分:0)
改变这个:
<script type="text/javascript"> function refreshiframe() {document.getElementById('feuille1').src = "http://competition.hockeyfrance.com/la/ffhgsheet.php?GameID=20094" setTimeout("refreshiframe()",30000); } </script>
要:
<script type="text/javascript"> function refreshiframe() {document.getElementById('feuille1').src = "http://competition.hockeyfrance.com/la/ffhgsheet.php?GameID=20094"; setTimeout("refreshiframe()",30000); } </script>
注意;
划分两条不同的js指令,一条用于更改src
,另一条用于调用setTimeout
函数。