您的位置:首页 > Web前端 > JavaScript

用js实现终止浏览器对页面HTML的继续解析即停止解析 兼容firefox

2007-11-10 00:00 856 查看
js怎么终止浏览器对页面HTML的解析啊?
如题

<html>
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
</head>
<script language="javascript" type="text/javascript">

//这里面要怎么写才能让浏览器不再解析和运行后面的表格和所有代码啊

</script>
<body>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
</tr>
</table>
</body>
</html>
IE下用document.execCommand("stop")  
FF下用window.stop();





测试一下



function mystop(){
if(!!(window.attachEvent && !window.opera))
{document.execCommand("stop");}
else
{window.stop();}
}
mystop();

就是不出来。

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
window.attachEvent && !window.opera是用来判断是否IE的!从Prototype里找出来的!
其实我还真不理解。。这是怎么判断的!
就像那个if(window.XMLHttpRequest)一样!
不过没事看看Prototype收获还是不少的!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐