jquery to get picture in chrome under the long width problem solving _javascript skills

Source: Internet
Author: User
Encountered a problem that required a long width to get the picture. In IE, Firefox are normal, on the TMD in Chrome, no one on the internet to say can, and then comes down to is not a chrome version of the problem.
Finally, finally, found the answer.

In most cases, place the JS code behind the picture label:
Copy Code code as follows:


<script>
Alert (document.getElementById ("test"). Width;<pre class=html name= "code" ></script></PRE>
<PRE></PRE>
This will get the width of the picture, but not under Chrome.
<P></P>
<P> even:</p> in jquery
<P></P>
<pre class=html name= "code" >$ (document). Ready (function () {
Alert (document.getElementById ("Test"). Width;
});</pre><br>
So, Chrome said no, I c.
<P></P>
<P> then, only the following methods of Chrome nod:</p>
<p style= "Text-align:left" ><span style= "line-height:21px" ></SPAN></P>
<pre class=html name= "code" >$ (window). Load (function () {
Alert ($ ("#test"). width ());
});</pre><br>
<BR>
<P></P>
<P><BR>
<BR>
</P>
<P><BR>
</P>
<PRE></PRE>
<PRE></PRE>
<PRE></PRE>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.