当前位置:网站首页>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;}边栏推荐
- SIT221 Data Structures and Algorithms课程辅导
- LitePal操作数据库
- MySQL - an SQL in MySQL is how to be performed?
- The practice of alibaba data synchronization component canal
- 添加用户报错useradd: cannot open /etc/passwd
- Summary of Logstash log data write exception troubleshooting
- 混币器Tornado遭制裁 对DeFi市场意味着什么?
- ①In-depth analysis of CAS SSO single sign-on framework source code
- The 125th day of starting a business - a note
- 数论基础-整除(编程例题)
猜你喜欢

CSAPP Data Lab

Js prototype and prototype chain and prototype inheritance

qtcreator调试webkit

ESP32的环境配置(arduino arduino2.0 VScode platform哪个好用?)

Add user error useradd: cannot open /etc/passwd

代码 Revert 后再次 Merge 会丢失的问题,已解决

TRCX: doping process analysis

leetcode: 358. Reorder strings at K distance intervals

leetcode:358. K 距离间隔重排字符串
![[idea error] Invalid target distribution: 17 solution reference](/img/39/cec5d854b1d941e866c7166b75aa22.png)
[idea error] Invalid target distribution: 17 solution reference
随机推荐
【Pdf自动生成书签】
The negative semantic transformation layer
关于地图GIS开发事项的一次实践整理(上)
What does the sanction of the mixer Tornado mean for the DeFi market?
df和df -lh的意思
YTU 2418: C语言习题 矩阵元素变换
this question in js
今天聊聊接口幂等性校验
postgresql ilike create function
TRCX: doping process analysis
思念家乡的月亮
(Nips-2015) Spatial Transformer Network
调试技巧总结
对加密世界的经济误解:现金是储蓄?稀缺性创造价值?
最倒霉与最幸运
维特智能惯导配置
ROS源代码阅读(1)
A practice arrangement about map GIS (below) GIS practice of Redis
Detailed explanation of new features of ES advanced function syntax
Summary of Logstash log data write exception troubleshooting