To provide three of the use of JS to obtain div width code Oh, the first simple and practical, the second access to the div width and height of the JS instance, the third instance is an S to get the specified div inside all the picture height and width code.
<input type= "button" onclick= "Calculate ()" value= "Test" >
<script>
function Calculate () {
var divs = document.getElementById ("Showtemptext");
Divs.innerhtml= "Wuao Ahshahsah <font size=6>jzread.com</font>";
Alert (divs.scrollwidth + "__" + divs.scrollheight);
}
</script>
<html>
<head>
<title>test page</title>
</head>
<body>
<table style= "width:100%;"
<tr>
<td>
<div id= "Div1" Style= "Background:green;" >div1</div>
<td>
<td style= "width:50%;"
<div id= "Div2" style= "background-color:red;" >div2 www.jzread.com</div>
<td>
</table>
<input type= "button" Onclick= ' Show () ' value= ' show '/>
<script>
function Show ()
{
var o = document.getElementById ("Div1");
var w = o.clientwidth| | O.offsetwidth;
alert ("Div1 s width is" wheels);
}
</script>
</body>
</html>
Here is a use of JS to get the specified div inside all the picture height and width js How to get this div inside the width of the picture and
<div style= "width:100000px" id= "pal"
<img src= "/www.jzread.com/images/2009021121575533977. JPG "width=" "486" height= "348"/>
<img src= "images/2009021121575533977.jpg"/>
<img Src= "Images/2009021121575533977.jpg"/>
<img src= "images/2009021121575533977.jpg"/>
<img src= "images/2009021121575533977.jpg"/>
<img src= "images/2009021121575533977.jpg"/>
<img src= "images/2009021121575533977.jpg"/>
<img src= "images/2009021121575533977.jpg"/ >
</div>
<script>
var obj=document.getelementbyid ("Pal");
var imgs=obj.getelementsbytagname ("img");
Var sum=0;
for (var i=0;i<imgs.length;i++)
sum+=imgs[i].width
Alert (sum);
</script>