Hello,
I'm learning cross-browser positioning and trying to apply it to the following web page:
The page consists of three tables stacked on top of each other and I am positioning the elements in the center table. I'm using the Ultimate Browser Sniffer (
I thought the easiest way would be to have a Javascript that calls different stylesheets depending on the platform/browser/version. I'm hoping someone will have the answer to 2 questions that might help me figure this out.
1) The javascript I wrote to call different stylesheets depending on the variables set up in the sniffer isn't working. It only calls the final statement (else) no matter what browser I'm testing in. Any ideas why?
2) Also, I initially tried to write this javascript to check more than one variable to determine which stylesheet to serve. This didn't work, so I'm wondering if my syntax is correct, or if I'm just writing it incorrectly. Here's what I wrote:
<link href="macie5up.css" rel="styleSheet" type="text/css">
<script language="JavaScript">
<!--
if ((is_macppc) && (is_ie5up))
{
document.write('<link href="macie5up.css" rel="styleSheet" type="text/css">'); }
else if ((is_macppc) && (is_nav4up))
{
document.write('<link href="macns4up.css" rel="styleSheet" type="text/css">'); }
else ((is_macppc) && (is_gecko))
{
document.write('<link href="macgecko.css" rel="styleSheet" type="text/css">'); }
-->
</script>
I'm hoping to get this to work in all IE and NS browsers 4 and up on Macs and PCs.
Thanks for any help!
cmdhtml
I'm learning cross-browser positioning and trying to apply it to the following web page:
The page consists of three tables stacked on top of each other and I am positioning the elements in the center table. I'm using the Ultimate Browser Sniffer (
I thought the easiest way would be to have a Javascript that calls different stylesheets depending on the platform/browser/version. I'm hoping someone will have the answer to 2 questions that might help me figure this out.
1) The javascript I wrote to call different stylesheets depending on the variables set up in the sniffer isn't working. It only calls the final statement (else) no matter what browser I'm testing in. Any ideas why?
2) Also, I initially tried to write this javascript to check more than one variable to determine which stylesheet to serve. This didn't work, so I'm wondering if my syntax is correct, or if I'm just writing it incorrectly. Here's what I wrote:
<link href="macie5up.css" rel="styleSheet" type="text/css">
<script language="JavaScript">
<!--
if ((is_macppc) && (is_ie5up))
{
document.write('<link href="macie5up.css" rel="styleSheet" type="text/css">'); }
else if ((is_macppc) && (is_nav4up))
{
document.write('<link href="macns4up.css" rel="styleSheet" type="text/css">'); }
else ((is_macppc) && (is_gecko))
{
document.write('<link href="macgecko.css" rel="styleSheet" type="text/css">'); }
-->
</script>
I'm hoping to get this to work in all IE and NS browsers 4 and up on Macs and PCs.
Thanks for any help!
cmdhtml