description
code is as follows:


<! DOCTYPE html>
<HTML lang="en" >
<Head>
<Meta charset="utf-8" >
<Title> Test
</head>
<Body>
<A id="a" href="" href ", 2) ">Test
</body>
</html>

click in Internet explorer 6, 7, pop-up big &other;/haha” !!!!!!!!!!! I began to suspect that other things doing mischief. At that moment, think of me a tag is how to (js template based on string, innerHTML) … … So, again using the following code simulation:

  code is as follows:  


<! DOCTYPE html>
<HTML lang="en" >
<Head>
<Meta charset="utf-8" >
<Title> Test
</head>
<Body>
<Div id="test" ></div>
<Script>
document. GetElementById (" test "). The innerHTML='<A id="a" href="http://www.jb51.net/haha" >Test ';
</script>
</body>
</html>

again, test … … Sister 's… … Recreate the problem! Measured, after generating a, again for a setAttribute (" href" "/haha" and 2), then the getAttribute (" href" and 2) can take back &other;/haha” . But if you want to do this in the template, seems too disgusted, decisively give up! Still hear the words of Frank … … Simply add a attribute identifies two kinds of link element, don't sidetrack.
to drill a drill -_ -! :

  code is as follows:  


<! DOCTYPE html>
<HTML lang="en" >
<Head>
<Meta charset="utf-8" >
<Title> Test
</head>
<Body>
<Div id="test" ></div>
<Script>
var test=document. GetElementById (" test ");
var a=document. The createElement method (" a ");
=var TXT document. The createTextNode (" test ");
a.h ref="http://www.jb51.net/haha";
a.o nclick=function () {
alert (enclosing the getAttribute (' href ', 2));///"haha", "
return false;
};
a.a ppendChild (TXT);
the test. The appendChild (a);
</script>
</body>
</html>

in the end, doubts through innerHTML insert node, 6, 7 will do some think its correct &other; Fault tolerance &throughout; Processing … … Let the, let I made a mistake … …


This concludes the body part