如何用JS在网页中替换HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>上服旅行网</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<script language="JavaScript" type="text/javascript">
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i){
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if( navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 &&
(navigator.appVersion.indexOf("Win") != -1) ) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
alert('有播放器')
setInterval('document.getElementById("zg_ab").cols="2000,*"')
}else{
alert('无播放器')
setInterval('document.getElementById("zg_ab").cols="0,*"')
<frame src="help/help.html" name="b" frameborder="no" scrolling="auto" id="b" title="rightFrame" />'
//上句代码的作用就是想把HTML中的<frame src="blank.html" name="b" frameborder="no" scrolling="auto" id="b" title="rightFrame" />替换为<frame src="help/help.html" name="b" frameborder="no" scrolling="auto" id="b" title="rightFrame" />'先加载一个空网页blank.html如果判断无FLASH播放器在载入help.html页.
但不能实现,请问如何写!!!
}
</script>
<frameset cols="2000,*" frameborder="no" border="0" framespacing="0" id="zg_ab">
<frame src="in_a.html" name="a" frameborder="no" scrolling="no" noresize="NORESIZE" id="a" title="mainFrame" />
<frame src="blank.html" name="b" frameborder="no" scrolling="auto" id="b" title="rightFrame" />
</frameset>
<noframes>
<body>
</body>
</noframes>
</html>