La valeur de la transfert li.html
La copie de code est la suivante:
<! Doctype html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8" />
<Title> Échangez la valeur de Li </Title>
<script type = "text / javascript">
window.onload = function () {
var lis = document.getElementById ("uLlist"). ChildNodes;
pour (var i = 0; i <lis.length; i ++) {
var myli = lis [i];
// juger si c'est une balise
if (myli.nodetype == 1) {
// Communiquez l'emplacement avec un Li ci-dessous
myli.onclick = function () {
if (this.nextelelementSibling) {
var nextli = this.nextelelementsibling; // cela ne peut être utilisé que ici, pas Myli
document.getElementById ("uLlist"). INSERTBEFORE (nextli, this);
}
};
}
}
}
</cript>
</ head>
<body>
<ul id = "ullist">
<li> Pékin </li>
<li> Shanxi </li>
<li> Shanghai </li>
<li> Tianjin </li>
<li> Henan </li>
</ul>
</docy>
</html>