(转)JS中innerHTML,innerText,value
原文:http://holysonll.blog.163.com/blog/static/21413909320134111054352/
JS中innerHTML,innerText,value
2013-05-11 11:24:49| 分类: JS与JQ | 标签:.innerhtml .value innertext |举报 |字号大中小 订阅

.value是一个介于innerHTML和innerText的效果
既不会显示代码,还可以显示文本
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <pid="demo">My First Paragraph.</p> <script> document.getElementById("demo").innerHTML="<h1>My First JavaScript</h1>"; </script> </body> </html>
输出结果:
MyFirstWebPage
MyFirstJavascript
innerText
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <pid="demo">My First Paragraph.</p> <script> document.getElementById("demo").innerText="<h1>My First JavaScript</h1>"; </script> </body> </html>
输出结果:
MyFirstWebPage
<h1>MyFirstJavascript</h1>
value
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <pid="demo">My First Paragraph.</p> <script> document.getElementById("demo").value="<h1>My First JavaScript</h1>"; </script> </body> </html>
输出结果:
MyFirstWebPage
MyFirstParagraph.
(转)JS中innerHTML,innerText,value的更多相关文章
- js 中innerHTML,innerText,outerHTML,outerText的区别
开头说下innerText和outerText只在chrome浏览器中有效 定义和用法 innerHTML 属性设置或返回表格行的开始和结束标签之间的 HTML,包括标签. 来看代码 <!DOC ...
- js中innerHTML、outerHTML与innerText的用法与区别
____________________________________________________________________________________________________ ...
- JS中innerHTML、outerHTML、innerText 、outerText、value的区别与联系?jQuery中的text()、html()和val()
一.JS中innerHTML.outerHTML.innerText .outerText.value的区别与联系?jS中设置或者获取所选内容的值:①innerHTML :属性设置或返回该标签内的HT ...
- js中innerHTML与innerText的用法与区别
用法: <div id="test"> <span style="color:red">test1</span> te ...
- js中innerHTML和innerText的用法
<div id="test"> <span style="color:red">test1</span> test2 < ...
- JS中innerHTML 和innerText和value的区别
(1)innerHTML 和innerText和value的区别: innerHTML innerText是对非表单元素进行操作的. value是对表单元素进行操作的. (2)innerHTML 和i ...
- JS中innerHTML和innerText,outerHTML和outerText
innerHTML 声明了元素含有的HTML文本,不包括元素本身的开始标记和结束标记 innerHTML是符合W3C标准的属性,而innerText只适用于IE浏览器(现在也适应chrome浏览器 ...
- JS中innerHTML,innerText,value
一·.JS初学者易混淆的问题:innerHTML,innerText,value(他们和JQ的区别:JS→value,JQ→value()) 1.getElementById("a" ...
- JS中innerHTML、outerHTML、innerText 、outerText、value的区别与联系?
1.innerHTML 属性 (参考自<JavaScript高级程序设计>294页) 在读模式下,innerHTML 属性返回与调用元素的所有子节点(包括元素.注释和文本节点)对应的 HT ...
随机推荐
- Struts2配置拦截器,struts2加载常量时的搜索顺序
1:struts2加载常量时的搜索顺序 1.Struts-default.xml 2.Struts-plugin.xml 3.Struts.xml 4.Struts-properties(自己创建的) ...
- python 将数据随机分为训练集和测试集
# -*- coding: utf-8 -*- """ Created on Tue Jun 23 15:24:19 2015 @author: hd "&qu ...
- 22. Generate Parentheses——本质:树,DFS求解可能的path
Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthes ...
- php变量与数组相互转换的方法(extract与compact
#php变量与数组相互转换的方法(extract与compact) #compact 多个变量转数组 $name = 'sui'; $email = 'sui@qq.com'; $arr = comp ...
- win7刷新图标缓存
建立bat文件 rem 关闭explorer.exetaskkill /f /im explorer.exeattrib -h -i %userprofile%\AppData\Local\IconC ...
- 腾讯大规模Hadoop集群实践 [转程序员杂志]
TDW(Tencent distributed Data Warehouse,腾讯分布式数据仓库)基于开源软件Hadoop和Hive进行构建,打破了传统数据仓库不能线性扩展.可控性差的局限,并且根据腾 ...
- GUID
前言 全局唯一标识符,简称GUID(发音为 /ˈɡuːɪd/或/ˈɡwɪd/),是一种由算法生成的唯一标识,通常表示成32个16进制数字(0-9,A-F)组成的字符串,如:{21EC2020-3AEA ...
- LinearLayout练习
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- Zooming MKMapView to fit annotation pins
http://stackoverflow.com/questions/4680649/zooming-mkmapview-to-fit-annotation-pins - (MKCoordinateR ...
- POJ 3264 Balanced Lineup 线段树 第三题
Balanced Lineup Description For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line ...