1<! DOCTYPE html>234<meta name= "viewport" content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, User-scalable=0 ">5<meta charset= "UTF-8" >6<title>Title</title>7<link href= "Css.css" type= "Text/css" rel= "stylesheet" >89<body class= "Site1" >Ten<div class= "Site" > One<span id= "Sheng" > Zhejiang </span> A -<span id= "Shi" > Hangzhou </span> - the<span id= "Qu" > Shangcheng District </span> -</div> -<div id= "Neirong" > -<!-- +<div class= "Site_list" > -<p class= "P6" > Shangcheng District </p> +</div> A<div class= "Site_list" > at<p class= "P6" > Xiacheng District </p> -</div> -<div class= "Site_list" > -<p class= "P6" > Jianggan District </p> -</div> -<div class= "Site_list" > in<p class= "P6" > Gongshu District </p> -</div> to<div class= "Site_list" > +<p class= "P6" > West L. District </p> -</div> the<div class= "Site_list" > *<p class= "P6" > Bingjiang District </p> $</div>Panax Notoginseng<div class= "Site_list" > -<p class= "P6" > Xiaoshan District </p> the</div> +<div class= "Site_list" > A<p class= "P6" > Yuhang </p> the</div> +<div class= "Site_list" > -<p class= "P6" > Tonglu County </p> $</div> $- -</div> -<div class= "SITE_BTN" > the<input type= "button" value= "OK" class= "OK1" > -<input type= "button" value= "Cancel" class= "Cancel" >Wuyi</div> the</body> -<script> Wu varNeirong = document.getElementById ("Neirong"); - varSheng = document.getElementById ("Sheng"); About varShi = document.getElementById ("Shi")); $ varQu = document.getElementById ("Qu"); -Sheng.onmousedown =function () { -Sheng.style.textDecoration = "Underline"; - }; ASheng.onmouseup =function () { +Sheng.style.textdecoration= "None"; the }; -Qu.onclick =function () { $ varDaima = "<div class= ' site_list ' ><p class= ' P6 ' > Tonglu County </p></div>" + the"<div class= ' site_list ' ><p class= ' P6 ' > Tonglu County 2</p></div>" + the"<div class= ' site_list ' ><p class= ' P6 ' > Tonglu County 3</p></div>"; theneirong.innerhtml =Daima; the /** Scope Problem **/ - /** Scope Problem **/ in /** Scope Problem **/ the /** Scope Problem **/ the /** Scope Problem **/ About /** Scope Problem **/ the the for(vari=0;i<liebiao.length;i++){ the(function(i) { +Liebiao[i].onclick =function () { -Qu.innertext = This. InnerText; the };Bayi }) (i) the } the - }; -Shi.onclick =function () { the varDAIMA1 = "<div class= ' site_list ' ><p class= ' P6 ' >shishishi</p></div>" + the"<div class= ' site_list ' ><p class= ' P6 ' >xx city </p></div>" + the"<div class= ' site_list ' ><p class= ' P6 ' > Yes Yes Yes </p></div>"; theneirong.innerhtml =daima1; - Console.log (Liebiao); the /** Scope Problem **/ the /** Scope Problem **/ the /** Scope Problem **/94 /** Scope Problem **/ the for(vari=0;i<liebiao.length;i++){ the(function(i) { theLiebiao[i].onclick =function () {98Shi.innertext = This. InnerText; About }; - }) (i)101 }102 };103 varLiebiao = Document.getelementsbyclassname ("Site_list");104</script> the
Scope!!!
Scope!!!
Scope!!!
Scope!!!
for (var i=0;i<liebiao.length;i++) { (function (i) { Liebiao[i].onclick = function () { Shi.innertext = this. InnerText; }; }
Native JS binds an event to each object in the array