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>
<p><script language="javascript"><br>
<!--<br>
var d = document.write;<br>
var cW = window.document.body.clientWidth<br>
<!--screen resolution sniffing --><br>
if(cW < 641) {window.document.body.background = "640.jpg"}<br>
else if (cW <801) {window.document.body.background = "800.jpg"}<br>
else if (cW < 1025) {window.document.body.background = "1024.jpg"}<br>
else if (cW < 1153) {window.document.body.background = "1152.jpg"}<br>
else if (cW < 1281) {window.document.body.background = "1280.jpg"}<br>
else if (cW < 1601) {window.document.body.background = "1600.jpg"}<br>
//--><br>
</script> </p><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.
<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>
<p><script language="javascript"><br>
<!--<br>
var d = document.write;<br>
var cW = window.document.body.clientWidth<br>
<!--screen resolution sniffing --><br>
if(cW < 641) {window.document.body.background = "640.jpg"}<br>
else if (cW <801) {window.document.body.background = "800.jpg"}<br>
else if (cW < 1025) {window.document.body.background = "1024.jpg"}<br>
else if (cW < 1153) {window.document.body.background = "1152.jpg"}<br>
else if (cW < 1281) {window.document.body.background = "1280.jpg"}<br>
else if (cW < 1601) {window.document.body.background = "1600.jpg"}<br>
//--><br>
</script> </p><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.