当前位置:网站首页>JS-DOM element object
JS-DOM element object
2022-08-11 02:56:00 【(- ^ _ ^)】
Get DOM properties for text and HTML content
innerHTML--------text or HTML tags in the node--------embedded in HTML (requires only text to prohibit tags)
innerText - the text inside the node has no HTML tags - only supports IE browsers
textContent - the text inside the node has no HTML tags - except for IE browsers
value - text in form control - input
Use DOM to adjust styles (color backgroundColor border, etc. and CSS have case differences)
Use JS code to set font boldness and style:
Set the font with JS code (use a function, the key point for setting different fonts is this)
JS code to set font size
Webpage Lorem ipsum dolor sit.
Lorem ipsum dolor sit.
Lorem ipsum dolor sit.
Lorem ipsum dolor sit.
Lorem ipsum dolor sit.
Lorem ipsum dolor sit.
Font: Serif Fantasy Monosapce
Style: Bold bold Ttalic oblique
function bold(){var a=document.getElementById('1');//Add positionif(this.checked){a.style.fontWeight="bold";}else{a.style.fontWeight="normal";}}function italic(){var a=document.getElementById('1');//Add positionif(this.checked){a.style.fontStyle="italic";}else{a.style.fontStyle="normal";}}function fontset(){var a=document.getElementById('1');//Add positiona.style.fontFamily=this.id; //current window//The font size is increased by 2pt, the original font size and 12 are selected to achieve the setting of 12 andvar oldSize =parseInt(a.style.fontSize) ||12;a.style.fontSize=(oldSize+2)+"pt";//Convert into characters, each time you select it, the font will expand}window.onload=function(){document.getElementById('bold').onclick=bold;//The above is connected into a sentencedocument.getElementById('italic').onclick=italic;document.getElementById('serif').onclick=fontset;document.getElementById('fantasy').onclick=fontset;document.getElementById('monosapce').onclick=fontset;}
边栏推荐
- 创业的第125天——随记
- "Beijing-Taiwan high-speed rail" debuted on Baidu map, can it really be built in 2035?
- Google search skills - programmer is recommended
- CSAPP Data Lab
- OpenHarmony啃论文俱乐部-啃论文心得
- 深度学习中的模型设计
- The negative semantic transformation layer
- Mysql_Note3
- Detailed explanation of new features of ES advanced function syntax
- DOM-DOM树,一个DOM树有三种类型的节点
猜你喜欢
DOM树的遍历-----修改样式,选择元素,创建和删除节点
flink The object probably contains or references non serializable fields.
Docker 链接sqlserver时出现en-us is an invalid culture错误解决方案
Detailed explanation of new features of ES advanced function syntax
A Practical Arrangement of Map GIS Development Matters (Part 1)
Vulnhub靶机:GEMINI INC_ 2
添加用户报错useradd: cannot open /etc/passwd
代码 Revert 后再次 Merge 会丢失的问题,已解决
DOM-DOM树,一个DOM树有三种类型的节点
深度学习-第二次
随机推荐
Mask RCNN 网络详解
带你系统学习MySQL索引
JVM类加载机制
A surviving spouse of the opposite sex within large turn paragraph, what for
The ifconfig compared with IP command
GBJ3510-ASEMI家电电源用整流桥GBJ3510
CSAPP Data Lab
Goodbye Chongqing paper invoices!The issuance of electronic invoices for accommodation expenses will soon completely replace the invoices of hotels, catering and gas stations
Docker 链接sqlserver时出现en-us is an invalid culture错误解决方案
经典面试题 之 GC垃圾收集器
Js prototype and prototype chain and prototype inheritance
创业的第125天——随记
解决vim与外界的复制粘贴(不用安装插件)
Multi-threaded ThreadPoolExecutor
0 in the figure, etc. LeetCode565. Array nesting
Official release丨VS Code 1.70
7 sorting algorithms that are often tested in interviews
Detailed explanation of new features of ES advanced function syntax
Add support for Textbundle
今天聊聊接口幂等性校验