开发者

Problem with getElementsByTagName in IE 8

开发者 https://www.devze.com 2023-04-08 05:31 出处:网络
I have problem this script dont working in IE 8 in Firefox is everything OK. <html> <style type=\"text/css\">

I have problem this script dont working in IE 8 in Firefox is everything OK.

<html>
<style type="text/css">
 lip{   position:absolute;     }
</style>
<body>
<ul>开发者_Python百科;<lip>3<input type = "checkbox" name = "LH3" id ='lhpz12' value="ANO"></lip></ul>
<script type="text/javascript">
var listElements = document.getElementsByTagName("lip");
var element = listElements[0];
    element.style.fontSize = "24px";
    element.style.color = "green";
    element.style.left = "100px";
    element.style.top = "100px";
</script>
</body>
</html> 


LIP isnt a valid tag, use something like a span or div.


In IE, those tags aren't until you create one in JavaScript. You should use a span here.

0

精彩评论

暂无评论...
验证码 换一张
取 消