我用IFrame中的问题,在主页面提控制子页面的地址和CSS
不知那里出错了~! <HTML>
<HEAD>
<TITLE> Test Page </TITLE>
</HEAD>
<BODY>
<script>function cSrc(url)
{
var ifm=document.getElementById( "test")
ifm.src=url;
}
function aaa(){
var newlink = document.frames["test"].document.createElement("link");
var ifm=document.getElementById( "test")
ifm.src=url;
newlink.setAttribute("rel", "stylesheet");
newlink.setAttribute("type", "text/css");
newlink.setAttribute("href", document.getElementById("link1").href);
document.frames["test"].document.body.appendChild(newlink);}
</script><link id="link1" rel="stylesheet" type="text/css" href="test.css"><div>测试文字</div>
<a href="#" onclick= "aaa('b.html')"> b</a>
<iframe name="test" src="b.html" ></iframe>
</BODY>
</HTML>
不知那里出错了~! <HTML>
<HEAD>
<TITLE> Test Page </TITLE>
</HEAD>
<BODY>
<script>function cSrc(url)
{
var ifm=document.getElementById( "test")
ifm.src=url;
}
function aaa(){
var newlink = document.frames["test"].document.createElement("link");
var ifm=document.getElementById( "test")
ifm.src=url;
newlink.setAttribute("rel", "stylesheet");
newlink.setAttribute("type", "text/css");
newlink.setAttribute("href", document.getElementById("link1").href);
document.frames["test"].document.body.appendChild(newlink);}
</script><link id="link1" rel="stylesheet" type="text/css" href="test.css"><div>测试文字</div>
<a href="#" onclick= "aaa('b.html')"> b</a>
<iframe name="test" src="b.html" ></iframe>
</BODY>
</HTML>
解决方案 »
- 大神们看看你能答对这个题嘛
- 童鞋们,我模拟了Google的电吉他,可录音,支持键盘
- 如何点击行变色的效率如何提高,我的代码会很卡!解决给分
- IE5.0下引用js脚本时的编码问题
- 如何通过一个复选框来控制其他相同名称的多个复选框的全选和反选???
- 怎么实现选择控件和textbox控件显示内容的互动?
- 我写的,计算某个页面的所有的hidden,text,把某六个text中的值传某六个hidden中
- 最后几分了,大家帮忙啊能不能用JAVASCRIPT写出一个类似于DELPHI中dialog的对话框
- 求一正则表达式
- javascript中怎么扑获异常,不要弹出错误提示?
- 请问javascript输出对象字符串问题?
- 为什么window.open()的第二个参数设置成空后能同时打开多个窗口?会默认生成不一样的title?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link id="cssLink" rel="stylesheet" type="text/css" href="test.css">
<script type="text/javascript">
function aaa(url){
var ifm = document.getElementById("test");
ifm.src = url;
var newlink = document.createElement("link");
newlink.setAttribute("rel", "stylesheet");
newlink.setAttribute("type", "text/css");
newlink.setAttribute("href", document.getElementById("cssLink").href);
(ifm.document || ifm.contentWindow.document).getElementsByTagName('head')[0].appendChild(newlink);
}
</script>
</head>
<body>
<a href="#" onclick="aaa('inner.html')"> b</a>
<iframe id="test"></iframe>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link id="cssLink" rel="stylesheet" type="text/css" href="test.css">
<title></title>
<script type="text/javascript">
function changeURL(url){
document.getElementById("test").src = url;
}
function _load(ifm){
var newlink = document.createElement("link");
newlink.setAttribute("rel", "stylesheet");
newlink.setAttribute("type", "text/css");
newlink.setAttribute("href", document.getElementById("cssLink").href);
(ifm.document || ifm.contentWindow.document).getElementsByTagName('head')[0].appendChild(newlink);
}
</script>
</head>
<body>
<a href="#" onclick="changeURL('inner.html')">b</a>
<iframe id="test" onload="_load(this);"></iframe>
</body>
</html>