Forum Moderators: open
2nd question is: is it sufficient to have the <noscript> tags as a test for browsers that have javascript disabled?
Thanks.
<script language="javascript">
<!--
if (screen.width <= 800)
{
document.write('<link rel="stylesheet" type="text/css" href="css/styles.css">');
}
else if (screen.width = 1024)
{
document.write('<link rel="stylesheet" type="text/css" href="css/styles.css">');
}
else if (screen.width > 1024)
{
document.write('<link rel="stylesheet" type="text/css" href="css/styles.css">');
}
else
{
document.write('<link rel="stylesheet" type="text/css" href="css/styles.css">');
}
//-->
</script>
<noscript>
<link rel="stylesheet" type="text/css" href="css/styles.css">
</noscript>
e.g. consider the code below (copied from what I found on Google btw)
function alertSize() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth ¦¦ document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth ¦¦ document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
window.alert( 'Width = ' + myWidth );
window.alert( 'Height = ' + myHeight );
}