Hello all,
I just found this site while I was searching for a solution to a problem. I am trying to switch CSS style sheets based on browser width.
I found this post by BlindPete faq215-4537 > which seemed like the answer I was looking for. I'm not very good at javascript and I get an error when I run this script.
Script:
<html>
<link href="manager.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
if (screen.width < 1024)
link = document.getElementsByTagName( "link" )[ 0 ];
link.href = "manager800.css";
</script>
<head>
Error is:
Line: 22
Char: 5
Error: 'link' is undefined
Code: 0
URL: location of the file
Line 22 = "link = document.getE......" line
Could someone explain this error and tell me how to fix it? I changed the href paths to my actual CSS files/paths.
I have another question. I looked at several other scripts elsewhere that were much more complicated, but several of them suggested using the property "window.screen.availWidth" instead of "screen.width" to resize based on browser window size instead of monitor size. Is this correct?
Thanks in advance! Looks like you have a great place here.
martin
(webseo)
I just found this site while I was searching for a solution to a problem. I am trying to switch CSS style sheets based on browser width.
I found this post by BlindPete faq215-4537 > which seemed like the answer I was looking for. I'm not very good at javascript and I get an error when I run this script.
Script:
<html>
<link href="manager.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
if (screen.width < 1024)
link = document.getElementsByTagName( "link" )[ 0 ];
link.href = "manager800.css";
</script>
<head>
Error is:
Line: 22
Char: 5
Error: 'link' is undefined
Code: 0
URL: location of the file
Line 22 = "link = document.getE......" line
Could someone explain this error and tell me how to fix it? I changed the href paths to my actual CSS files/paths.
I have another question. I looked at several other scripts elsewhere that were much more complicated, but several of them suggested using the property "window.screen.availWidth" instead of "screen.width" to resize based on browser window size instead of monitor size. Is this correct?
Thanks in advance! Looks like you have a great place here.
martin
(webseo)