Click to See Complete Forum and Search --> : Diffrent content depending on the browers


Fod
11-15-2003, 11:44 AM
Ok, this guy over at Dev Shed is having a bit of a problem with this scroller on his page.

I think i have a way to fix it. But i don't know Javascript all-to-well. but i've heard with JavaScript you can display diffrent contect depending on the brower you are viewing the page with.

So what i would like some one to do is make him a script an despalys :

<DIV class=content>
<H1>Welcome!</H1>
<P>
<table width="100%" cellpadding="0" cellspacing="0"><tr><td align="center">
<SCRIPT src="scroller.js" type=text/javascript></SCRIPT>
</td></tr></table>
</P></DIV>

if viewed with NetScape and


<DIV class=content>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td colspan="2">
<H1>Welcome!</H1>
</td></tr>
<tr><td width="343"></td><td align="center">
<SCRIPT src="scroller.js" type=text/javascript></SCRIPT>
</td></tr></table>
</DIV>

If viewed with Internet Explorer.

Jona
11-15-2003, 12:05 PM
I see no particular reason for using TABLEs for layout: http://www.w3.org/TR/WAI-WEBCONTENT/wai-pageauth.html#tech-avoid-table-for-layout

Also, approximately 13% of users do not have JavaScript enabled, meaning this will make the page inaccessible to those users. Therefore, it is best to use a server-side language to determine the user agent (browser) which is being used, and display different code depending on which... Not to mention the W3C also says not to use JavaScript without providing an alternate means of functionality: http://www.w3.org/TR/WAI-WEBCONTENT/wai-pageauth.html#tech-scripts

[J]ona

Fod
11-15-2003, 12:13 PM
well to-bad for 13% of users

Jona
11-15-2003, 12:16 PM
Originally posted by Fod
well to-bad for 13% of users

Too bad someone else will have to assist you.

[J]ona

Fod
11-15-2003, 12:17 PM
Heh..

Well, then some one else please help.