javascript - bug IE 11 with overflow auto -
there bug on ie 11 when empty html in div , remove class in list javascripts. div loses syle css "overflow:auto" , guard great height there no bug on navigator.
sample:
<!doctype html> <html> <head> <title>css</title> <style> div { margin: 5px; } ul { margin: 5px; max-height: 200px; overflow: auto; } ul li.selected { font-weight: bold; } .dest { width: 500px; min-height: 21px; max-height: 120px; overflow: auto; border: 1px solid #ccc; background-color: #f9f9f0; padding: 3px; } .dest span { display: block; background-color: #fff; float: left; border-radius: 2px; border: 1px solid #ccc; margin: 2px; padding: 0px 2px 0px 2px; line-height: 21px; height: auto; } </style> <script> window.onload = function(){ document.getelementbyid("btclear").onclick = function(){ document.getelementbyid("dest").innerhtml = ""; }; document.getelementbyid("btclearplus").onclick = function(){ document.getelementbyid("dest").innerhtml = ""; var ul = document.getelementbyid("list"); var lis = ul.getelementsbytagname("li"); for (var = 0; < lis.length; i++) { lis[i].classname = ""; } }; document.getelementbyid("btall").onclick = function(){ for(var = 0; < 50; i++) { var span = document.createelement("span"); span.innerhtml = "first name " + + " last name " + i; document.getelementbyid("dest").appendchild(span); } var ul = document.getelementbyid("list"); var lis = ul.getelementsbytagname("li"); for (var = 0; < lis.length; i++) { lis[i].classname = "selected"; } }; for(var = 0; < 50; i++) { for(var = 0; < 50; i++) { var li = document.createelement("li"); li.innerhtml = "nom" + + " prenom" + i; document.getelementbyid("list").appendchild(li); } } } </script> </head> <body> <div id="dest" class="dest"></div> <div> <ul id="list"></ul> </div> <div> <button id="btall">select all</button> <button id="btclear">clear all</button> <button id="btclearplus">clear , deselect</button> </div> </body> </html>
thank you, jean-pierre
change 1 of loops variable i
j
because have same variable in both loops
for(var = 0; < 50; i++) { for(var j = 0; j < 50; j++) { // logic } }
Comments
Post a Comment