Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with background script for different browsers

Status
Not open for further replies.

hvyhed

Programmer
Jul 20, 1999
2
0
0
US
I am relatively new to web designing (6 months) and am trying to get a javascript to work in different browsers. The objective is to browse the client side type of browser used. Once identified need to check for screen resolution then to post the proper sized background on their screen. <br>
<br>
1. I need a script that will search for client browser.<br>
2. Once browser identified what will script be.<br>
3. I have script to check screen resolution, but will it work for all. Currently works in MSIE.<br>
&lt;p&gt;&lt;script language="javascript"&gt;<br>
&lt;!--<br>
var d = document.write;<br>
var cW = window.document.body.clientWidth<br>
&lt;!--screen resolution sniffing --&gt;<br>
if(cW &lt; 641) {window.document.body.background = "640.jpg"}<br>
else if (cW &lt;801) {window.document.body.background = "800.jpg"}<br>
else if (cW &lt; 1025) {window.document.body.background = "1024.jpg"}<br>
else if (cW &lt; 1153) {window.document.body.background = "1152.jpg"}<br>
else if (cW &lt; 1281) {window.document.body.background = "1280.jpg"}<br>
else if (cW &lt; 1601) {window.document.body.background = "1600.jpg"}<br>
//--&gt;<br>
&lt;/script&gt; &lt;/p&gt;<br>
<br>
I have tried diffent sites for a script that will work but have had no luck. Hope I am making sense here and that this is possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top