javascript刷新页面?js返回上一页并刷新
一、js怎么写2秒后再刷新当前页面
设置定时2秒后执行刷新。<scripttype="text/javascript">setTimeout(function(){//使用setTimeout()方法设定定时2000毫秒window.location.reload();//页面刷新},2000);</script>
二、js怎么定时刷新指定页面
将<metahttp-equiv=\\\"refresh\\\"content=\\\"20\\\">添加到head中,content=\\\"20\\\"指每隔20秒刷新一次页面.也可以用下面的JS控制<scriptlanguage=\\\"JavaScript\\\">functionmyrefresh(){window.location.reload();}setTimeout(\\\'myrefresh()\\\',1000);//指定1秒刷新一次</script>或者是functionrefresh(){window.location.href=\\\"当前页面URL\\\";setTimeout(\\\"refresh()\\\",10000);}
三、js刷新父页面
用iframe、弹出子页面刷新父页面iframe
<scriptlanguage=JavaScript>
parent.location.reload();
</script>
弹出子页面
<scriptlanguage=JavaScript>
window.opener.location.reload();
</script>
子窗口刷新父窗口
<scriptlanguage=JavaScript>
self.opener.location.reload();
</script>
刷新以open()方法打开的窗口
<scriptlanguage=JavaScript>
window.opener.location.href=window.opener.location.href;
</script>
刷新以winodw.showModelDialog()方法打开的窗口
<scriptlanguage="javascript">
window.parent.dialogArguments.document.execCommand('Refresh');
</script>