Home  >  Article  >  Web Front-end  >  document.createElement("A") relatively good attributes_javascript skills

document.createElement("A") relatively good attributes_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:10:461691browse

After working on it for a day, I finally got the attributes in A
Code 1:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]


Code 2:


[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute ]<script> function newelement(){ var a=document.createElement("a"); a.href="javascript:alert('A link.')"; a.innerHTML="aaa"; var img=new Image(); img.src="http://img.baidu.com/img/post-jg.gif"; img.style.border="none"; a.appendChild(img) document.getElementById("oData").appendChild(a); img.onmouseover=function(){ this.src="http://www.baidu.com/img/sslm1_logo.gif"; } img.onmouseout=function(){ this.src="http://img.baidu.com/img/post-jg.gif"; } } </script>
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