我写了一个html页面,它使用一些javascript来隐藏和显示flash电影对象。一切正常,直到我尝试退出选项卡,当发生这种情况时,整个浏览器将崩溃而不是错误文本框。有人可以帮忙吗?感谢
Flash代码
if(ExternalInterface.available)
ExternalInterface.call('hideTimeline');
Javascript代码
function showTimelineFirstPlay()
{
var timeline = document.createElement('span');
timeline.id = "timeLineer"
// WIDTH=1217 HEIGHT=170
//document.write(document.getElementById('topper').offsetHeight);
var fHeight = document.getElementById('topper').offsetHeight;
var fWidth = document.getElementById('topper').offsetWidth - 10;
var hHeight = fHeight + 100;
var hWidth = fWidth - 150;
timeline.innerHTML = "<OBJECT id='fTrans' allowScriptAccess='sameDomain' style = 'solid;border-color:#960000; border-width:3px;position:absolute; top:95; left:15;' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' WIDTH="+fWidth+" HEIGHT="+fHeight+"> <PARAM NAME=movie VALUE='FirstPlay.swf'> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#ffffff> </object><span onclick='hideTimeline()'style='color:#0098db;position:absolute; left:"+hWidth+"; top:"+hHeight+"'>- Hide Timeline</sapn>";
topper.appendChild(timeline);
}
function hideTimeline()
{
topper.removeChild(document.getElementById('timeLineer'));
}
window.onload = function()
{
showTimelineFirstPlay();
}
答案 0 :(得分:0)
插件可能正在崩溃,因为您正在调用hideTimeline并在SWF等待响应时删除SWF。
尝试在hideTimeline中启动一个计时器,该计时器将在50之后删除。
miliseconds.topper.removeChild(document.getElementById('timeLineer'));