In the head tag:
<script type="text/javascript"> function giveWidth(e) { document.getElementById('wid').innerHTML = window.innerWidth; } </script>
In the body tag:
<p>Window width <a href="" onclick="giveWidth(event);return false">is</a> <span id="wid">500</span> pixels.<p>
The return false makes sure that the browser doesn't try to open a new window when you click on the link.
No comments:
Post a Comment
Please enter your message here...