×

iframe 属性 属性 js

js如何修改iframe 中元素的属性?网页JS弹出广告代码,头部,右下角,网页中漂浮,对联广告代码等大全

admin admin 发表于2022-05-23 15:37:18 浏览111 评论0

抢沙发发表评论

js如何修改iframe 中元素的属性


网页加载的时候,iframe里面的还没加载完当然就更改不了
1.纯js的
《!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN“ “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“》
《html xmlns=“http://www.w3.org/1999/xhtml“》
《head》
《meta http-equiv=“Content-Type“ content=“text/html; charset=utf-8“ /》
《title》无标题文档《/title》
《script language=“javascript“》
function c(){
var a;
try{
if (document.all){
a = document.frames[“a“].document;

}else{
a = document.getElementById(“a“).contentDocument;
}
var b = a.getElementsByName(“b“);
b.disabled = true;
clearInterval(d);
}
catch(ex){

}
}
《/script》
《/head》
《body》
《iframe id=“a“ src=“b.html“ onload=“c();“》《/iframe》
《/body》
《/html》
2.使用jQuery框架的,建议使用,封装了js,操作DOM等等非常方便
《!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN“ “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“》
《html xmlns=“http://www.w3.org/1999/xhtml“》
《head》
《meta http-equiv=“Content-Type“ content=“text/html; charset=utf-8“ /》
《title》无标题文档《/title》
《script language=“javascript“ src=“/js/jquery-1.4.4.js“ type=“text/javascript“》《/script》
《script language=“javascript“ type=“text/javascript“》
《!--//
$(document).ready(function(){
if ($.browser.msie){
$(’#a’).ready(function(){
$(window.frames[“a“].document).find(“input“).attr(“disabled“,“disabled“);
});
}
else{
$(’#a’).load(function(){
$(’#a’).contents().find(“input“).attr(“disabled“,“disabled“);
});
}
});
//--》
《/script》
《/head》
《body》
《iframe id=“a“ name=“a“ src=“iframechild.html“》《/iframe》
《/body》
《/html》

b.html
《!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN“ “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“》
《html xmlns=“http://www.w3.org/1999/xhtml“》
《head》
《meta http-equiv=“Content-Type“ content=“text/html; charset=utf-8“ /》
《title》无标题文档《/title》
《/head》

《body》
《form name=“cform“》《input type=“text“ name=“b“ /》《/form》
《/body》
《/html》

网页JS弹出广告代码,头部,右下角,网页中漂浮,对联广告代码等大全


1.最简单的方法:
public static String reverse1(String str)
{ return new StringBuffer(str).reverse().toString();
}
2.最常用的方法:
public static String reverse3(String s)
{ char array = s.toCharArray();
String reverse = ““; //注意这是空,不是null
for (int i = array.length - 1; i 》= 0; i--)
reverse += array[i];
return reverse;
}
3.常用方法的变形:
public static String reverse2(String s)
{ int length = s.length();
String reverse = ““; //注意这是空,不是null
for (int i = 0; i 《 length; i++)
reverse = s.charAt(i) + reverse;//在字符前面连接, 而非常见的后面
return reverse;
}

编写jsp除了myeclipse 还有什么好用的工具(要求界面友好,提示功能强大)


netbeans,是sun(现在是甲骨文公司的了)的开源免费软件,功能还是很强大的。
JBuilder,不是年费的,不过用起来很上手。
myEclipse,也不是免费的,里面集成好很多插件。