js實(shí)現(xiàn)運(yùn)行代碼需要刷新的解決方法
更新時間:2007年08月18日 22:42:12 作者:
現(xiàn)在大多網(wǎng)站都有“運(yùn)行代碼”的功能,搜索吧也很早就實(shí)現(xiàn)了這個功能,但最近在做一個項(xiàng)目時,發(fā)現(xiàn)有些需要刷新才能看到結(jié)果,自己摸索了下,其實(shí)解決方法很簡單,看如下代碼:
function runCode(cod1) {
cod=document.getElementById(cod1)
var code=cod.innerText;
var newwin=window.open('','','');
newwin.opener = null;
newwin.document.write(code);
newwin.location.reload();
newwin.document.close();
}
只要加上這句就可以了:
newwin.location.reload();
function runCode(cod1) {
cod=document.getElementById(cod1)
var code=cod.innerText;
var newwin=window.open('','','');
newwin.opener = null;
newwin.document.write(code);
newwin.location.reload();
newwin.document.close();
}
只要加上這句就可以了:
newwin.location.reload();
相關(guān)文章
基于js實(shí)現(xiàn)微信發(fā)送好友如何分享到朋友圈、微博
微信瀏覽器內(nèi)置了javascript私有對象WeixinJSBridge,可以實(shí)現(xiàn)發(fā)送給朋友、分享到朋友圈、分享到微博等功能,本篇文章給大家介紹基于js實(shí)現(xiàn)微信發(fā)送給朋友如何分享到朋友圈、微博,感興趣的朋友一起學(xué)習(xí)吧2015-11-11firefox和IE系列的相關(guān)區(qū)別整理 以備后用
firefox和IE系列的相關(guān)區(qū)別整理,整理相對來說還可以,但對于個別細(xì)節(jié)的處理不夠完善。具體的可以參考腳本*之家以前發(fā)布的文章。2009-12-12