脚本在博客中不起作用

时间:2012-12-23 15:18:11

标签: javascript blogger popupwindow

以下脚本在博客帖子中使用时无效。任何帮助??

var popvid = null;

function popWin(divId) {
    if(typeof(divId) == 'string') {
        divId = document.getElementById(divId);
    }
    if(!popvid || popvid.closed) {
        popvid = window.open('', 'vidplayer', 'top=200,left=390,width=450,height=375,status=no');
    }
    popvid.document.body.style.backgroundColor = 'black';
    popvid.focus();
    popvid.document.body.innerHTML = '<BR><center>' + divId.innerHTML + '</center>';
    return false;
}
window.onunload = function() {
    if(popvid) {
        popvid.close();
    }
}

其次是:

<div id='popvid1' style='display: none'>
<embed style="width:426px; height:320px;" id="VideoPlayback" 
type="application/x-shockwave-flash" 
src="http://www.antenna.gr/webtv/images/fbplayer.swf?cid=07_f_y_mfa_y$_a_e=&volx=100&iu=1&telemetry=false" allowFullScreen="true" allowScriptAccess="sameDomain" flashvars="controls=true"></embed>
</div>
<div id='popvid2' style='display: none'>
<embed style="width:426px; height:320px;" type="application/x-shockwave-flash" src="http://www.antenna.gr/webtv/images/fbplayer.swf?cid=y_n_y_prr6pd_sc=&volx=100&iu=1&telemetry=false" allowFullScreen="true" allowScriptAccess="sameDomain" flashvars="controls=true"> </embed>
</div>
<button href="#" onclick="return popWin('popvid1');" class=popup>01</button>
<button href="#" onclick="return popWin('popvid2');" class=popup>02</button>

1 个答案:

答案 0 :(得分:0)

您不能在博主帖子中添加脚本。帖子只能包含HTML代码。任何脚本都必须单独添加到模板HTML中。

点击此链接以了解类似用途:http://www.atoztoa.com/2012/12/multilevel-list-in-blogger-post.html