This Tutorial Has Been Viewed 3,855 Times.
Very easy to get the browser window size using javascript, grab the code here
<script type="text/javascript" >
function getBroWinSize() {
var objDocEle = document.documentElement;
var objDocBdy = document.body;
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) { //Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}
else if(objDocEle &&(objDocEle.clientWidth || objDocEle.clientHeight)) { //IE 6+
myWidth = objDocEle.clientWidth;
myHeight = objDocEle.clientHeight;
}
else if(objDocBdy &&(objDocBdy.clientWidth || objDocBdy.clientHeight)){ //IE 4
myWidth = objDocBdy.clientWidth;
myHeight = objDocBdy.clientHeight;
}
window.alert( 'Width = ' + myWidth );
window.alert( 'Height = ' + myHeight );
}//getBroWinSize
</script>
<input type="button" value="check" onClick="getBroWinSize()"/>
You will also be interested in ,
- Add to favorites or bookmarking using javascript in firefox and internet explore [IE]
- Customized popup or alert box using CSS and Javascript
- Encode and Decode Strings using javascript.
- Copy form field values using javascript
- Limit Textarea Characters Using Javascript
- Check whether the browser is Internet Explorer or not using javascript
- Drop down menu going behind flash element
- Add a mouse cursor or pointer trailing text using javascript
- Change first letter of each word in a form field from lowercase to uppercase
- Jquery news ticker with unlimited scrolling
Categories: JavaScripts