<img src="http://c.csdn.net/bbs/t/5/i/pic_logo.gif" />
<script type="text/javascript">
var imgs = document.images;
var t = document.createElement("IMG");
t.src = imgs[0].src;
imgs[j].outerHTML = "_";
alert(t.src);//FF下支持outerHTML操作
if(typeof(HTMLElement)!="undefined" && !window.opera) {
HTMLElement.prototype.__defineGetter__("outerHTML",function() {
var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++)
if(a[i].specified)
str+=" "+a[i].name+'="'+a[i].value+'"';
if(!this.canHaveChildren)
return str+" />";
return str+">"+this.innerHTML+"</"+this.tagName+">";
});
HTMLElement.prototype.__defineSetter__("outerHTML",function(s) {
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var df = r.createContextualFragment(s);
this.parentNode.replaceChild(df, this);
return s;
});
HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
});
}
</script>
我在网上找了一段代码加上后 似乎不管用???请问怎么操作!!!
<script type="text/javascript">
var imgs = document.images;
var t = document.createElement("IMG");
t.src = imgs[0].src;
imgs[j].outerHTML = "_";
alert(t.src);//FF下支持outerHTML操作
if(typeof(HTMLElement)!="undefined" && !window.opera) {
HTMLElement.prototype.__defineGetter__("outerHTML",function() {
var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++)
if(a[i].specified)
str+=" "+a[i].name+'="'+a[i].value+'"';
if(!this.canHaveChildren)
return str+" />";
return str+">"+this.innerHTML+"</"+this.tagName+">";
});
HTMLElement.prototype.__defineSetter__("outerHTML",function(s) {
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var df = r.createContextualFragment(s);
this.parentNode.replaceChild(df, this);
return s;
});
HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
});
}
</script>
我在网上找了一段代码加上后 似乎不管用???请问怎么操作!!!
解决方案 »
- 把左边记录移到右边,在线等
- 在JQuery中,我想去除“.”之前的所有字符,该如何做?
- 如何<a href=# onclick="changehtmlcontent()">连接</a>选择后网页的当前位置不动
- 文本里只能输入大写的英文字母和1-9数字和“-”,如果这个字符串里有其他的任何字符都要提示,我的程序不知道在那里错了
- 关于组织在线文本编辑器开源项目的建议
- 非Windows平台下如何用JS读取XML
- 为什么在选项卡中百度地图 加了display:none; 会不显示背景
- 统计文本框的字数
- 下拉菜单问题!急!今日必须解决!马上结帐!
- 求助!这样的滚动新闻写一个正确;写两处就不对:(
- js文件上传
- javascript生成的radio不能多选(name不同)
<script type="text/javascript">
//FF下支持outerHTML操作
if(typeof(HTMLElement)!="undefined" && !window.opera) {
HTMLElement.prototype.__defineGetter__("outerHTML",function() {
var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++)
if(a[i].specified)
str+=" "+a[i].name+'="'+a[i].value+'"';
if(!this.canHaveChildren)
return str+" />";
return str+">"+this.innerHTML+"</"+this.tagName+">";
});
HTMLElement.prototype.__defineSetter__("outerHTML",function(s) {
var r = this.ownerDocument.createRange();
r.setStartBefore(this);
var df = r.createContextualFragment(s);
this.parentNode.replaceChild(df, this);
return s;
});
HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
});
}
document.getElementById("img1").outerHTML = "<img src=\"http://zi.csdn.net/210-60rz.gif\">"
</script>
if(this.parentElement)return this.parentElement.innerHTML;
alert(this.parentElement)
var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++)
if(a[i].specified)
str+=" "+a[i].name+'="'+a[i].value+'"';
if(this.canHaveChildren!=undefined && !this.canHaveChildren)return str+" />";
return str+">"+this.innerHTML+"</"+this.tagName+">";
});
var a=this.attributes, str=" <"+this.tagName, i=0;for(;i <a.length;i++)
if(a[i].specified)
str+=" "+a[i].name+'="'+a[i].value+'"';
if(this.canHaveChildren!=undefined && !this.canHaveChildren)return str+" />";
return str+">"+this.innerHTML+" </"+this.tagName+">";
});