innerHtml,innerText,textContent
innerHtml获取元素带标签的内容;innerText只获取元素的文本;
火狐不支持innerText,支持textContent;

// IE和Firefox都能用的设置/获取对象属性函数

aobj = document.getElementById("alink");
firefox_ie(aobj,"http://www.test.com") function firefox_ie(obj,value)
{
if(document.all){
if(typeof(value)=="undefined")
return obj.innerText;
else
obj.innerText=value;
}else{
if(typeof(value)=="undefined")
return obj.textContent;
else
obj.textContent=value;
}
}

innerHtml innerText textContent兼容性问题的更多相关文章

  1. innerHTML,innerText,textContent,outerHTML的用法以及区别

    innerHTML获取的是对象起始的位置到终止位置全部内容,包含html标签. innerText和textContent结果是一样的,不包含标签,直接获取标签内的内容,区别是两者浏览器的兼容性. o ...

  2. innerHTML..innerText..textContent

    /* * innerText和textContent 都是设置文字内容的,如果设置的内容当中有标签,也会直接的以文本的方式显示(标签的<>都会按照转义的方式进行解析) * innerTex ...

  3. vue-learning:12 - 2 - 区分:outerHTML - innerTHML - outerText - innerText - textContent

    区分:outerHTML - innerTHML - outerText - innerText - textContent 获取值 <div id="outer"> ...

  4. innerHTML,innerText,outHTML,outText区别

    <p><div id="div" style="background-color:#ff9966;border:1px #ff0000 dashed;& ...

  5. innerHTML innerText的使用和区别

    document对象中有innerHTML.innerText这两个属性,都是获取document对象文本内容,但使用起来还是有区别的: 1) innerHTML设置或获取标签所包含的HTML+文本信 ...

  6. innerHTML .innerText区别

    ().innerHtml("“):改变html元素: ().innerTEXT(”“):改变文本元素: 试验代码 <!DOCTYPE html> <html lang=&q ...

  7. js 中innerHTML,innerText,outerHTML,outerText的区别

    开头说下innerText和outerText只在chrome浏览器中有效 定义和用法 innerHTML 属性设置或返回表格行的开始和结束标签之间的 HTML,包括标签. 来看代码 <!DOC ...

  8. innerHTML innerText与outerHTML间的区别

    innerHTML与innerText及outerHTML间的区别最容易使初学者搞混淆,为了更好的使读者区分开.下面我就通过一个demo来解释: 代码: <!DOCTYPE html>&l ...

  9. javaScript中innerHTML,innerText,outerHTML,outerText的区别

    开头说下innerText和outerText只在chrome浏览器中有效 定义和用法 innerHTML 属性设置或返回表格行的开始和结束标签之间的 HTML,包括标签. 来看代码 <!DOC ...

随机推荐

  1. Java数据库——JDBC 2.0操作

    可滚动的结果集 让结果集滚动起来 //================================================= // File Name : JDBC20_demo //-- ...

  2. Java简单的系统登陆

    class Check{ public boolean validate(String name,String password){ if(name.equals("lixinghua&qu ...

  3. 有scp命令,传输文件却显示报错无此命令

    今天下午在一台服务器上使用scp命令向另外一台服务器传文件的时候,报此错误 bash: scp: command not found ,lost connection,以为是该服务器没有安装此命令,w ...

  4. MAFFT多重序列比对--(附比对彩标方法)

    [转记]MAFFT多重序列比对图解教程 [絮语] 一提到多重序列比对,很多人禁不住就想到ClustalW(Clustalx为ClustalW的GUI版),其实有一款多重序列比对软件-MAFFT,不论从 ...

  5. MySQL出错:ERROR 1045 (28000)的解决方法

    MySQL突然不能用了,症状如下: [root@bogon ok]# mysql ERROR (): Access denied for user 'root'@'localhost' (using ...

  6. How to know if file is complete on the server using FTP

    This is a very old and well-known problem. There is no way to be absolutely certain a file being wri ...

  7. php页面防重复提交方法总结

    1.提交按钮置disabled 当用户提交后,立即把按钮置为不可用状态.这种用js来实现. 提交前 复制代码 代码如下:         $("#submit").attr('di ...

  8. jQuery.validator 验证规则详解

    前言:jQuery.validator是一款非常不错的表单验证插件,验证方式非常简单方便,它还对HTML5做了兼容处理,了解了验证规则,就基本掌握了它的使用,下面就让我一一道来 jQuery.vali ...

  9. spark在windows下的安装

      Windows下最简的开发环境搭建这里的spark开发环境, 不是为apache spark开源项目贡献代码, 而是指基于spark的大数据项目开发. Spark提供了2个交互式shell, 一个 ...

  10. [译]View components and Inject in ASP.NET MVC 6

    原文:http://www.asp.net/vnext/overview/aspnet-vnext/vc 介绍view components view components (VCs) 类似于part ...