Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 0

Bat/jsCode

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
The license selected for the repository is subject to the license used by the main branch of the repository.
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
jsCode
/
basic
/
DOM
/
attribute.html
jsCode
/
basic
/
DOM
/
attribute.html
attribute.html 963 Bytes
Copy Edit Raw Blame History
dev-shq authored 2019年07月10日 09:36 +08:00 . 201907100936-js基础练习代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>通过class属性查找</title>
</head>
<body>
<div>
<p class="fish">草鱼</p>
<p class="fish">草鱼</p>
<p class="fish">草鱼</p>
<span id="app" class="fields">看来季后赛得分手段</span>
</div>
<script type="text/javascript">
// 1、dom对象。属性名
var radios = document.getElementsByClassName('fish');
radios[0].id = 'red';
// 2、通过对象方法 setAttribute getAttribute removeAttribute
var app = document.getElementById('app');
// console.log(app);
var attr = app.getAttribute('class');
console.log(attr);
// 设置与修改属性
app.setAttribute('class','first');
// 删除属性
app.removeAttribute('class');
// 操作文本内容 innerText
radios[1].innerText = '<em>jlkasdjfa;lfj</em>'
// 操作里面html子标签(解析内容里面的div标签) innerHTML
radios[2].innerHTML = '<span>jlkasdjfa;lfj<div>流口水的</div></span>'
</script>
</body>
</html>
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

No description
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/shqdev/jsCode.git
git@gitee.com:shqdev/jsCode.git
shqdev
jsCode
jsCode
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /