Home >Web Front-end >JS Tutorial >js dynamically add tags (adding a new line, it is actually very simple, just the application of several functions)_javascript skills

js dynamically add tags (adding a new line, it is actually very simple, just the application of several functions)_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:54:581204browse
复制代码 代码如下:




add_line





















配置文件上传
























把所有代码拷下另存为一个html文件,在浏览器中打开,点击“新增一行”按钮就可以,以下是对js函数的解释

document.createElement 创建一种页面标签
setAttribute:为某一标签设置属性
appendChild:在另一标签中添加一子标签
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn