Diferencia entre revisiones de «MediaWiki:Descubriendo09.js»
De Descubriendo la Física
Ir a la navegaciónIr a la búsqueda| (No se muestran 2 ediciones intermedias del mismo usuario) | |||
| Línea 8: | Línea 8: | ||
winW = document.body.offsetWidth-20; |
winW = document.body.offsetWidth-20; |
||
winH = document.body.offsetHeight-20; |
winH = document.body.offsetHeight-20; |
||
| + | } |
||
| + | if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; |
||
| + | var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number |
||
| + | if (ieversion>=8) |
||
| + | {alert("You're using IE8 or above"); |
||
| + | winW = document.body.offsetWidth; |
||
| + | winH = document.body.offsetHeight; |
||
| + | } |
||
| + | else if (ieversion>=7) |
||
| + | {alert("You're using IE7.x"); |
||
| + | winW = document.body.offsetWidth; |
||
| + | winH = document.body.offsetHeight; |
||
| + | } |
||
| + | else if (ieversion>=6) |
||
| + | {alert("You're using IE6"); |
||
| + | winW = document.body.offsetWidth; |
||
| + | winH = document.body.offsetHeight; |
||
| + | } |
||
| + | else if (ieversion>=5) |
||
| + | {alert("You're using IE5"); |
||
| + | winW = document.body.offsetWidth; |
||
| + | winH = document.body.offsetHeight; |
||
} |
} |
||
} |
} |
||
| + | } |
||
| + | |||
| ⚫ | |||
| − | alert(winH+" "+winW); |
||
| ⚫ | |||
document.write(linea); |
document.write(linea); |
||
document.body.style.background="url('/descubriendo/background.php?anchoPantalla="+ window.screen.width + "');" |
document.body.style.background="url('/descubriendo/background.php?anchoPantalla="+ window.screen.width + "');" |
||
Revisión actual - 20:55 18 jun 2010
if (window.screen) {
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth-16;
winH = window.innerHeight-16;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth-20;
winH = document.body.offsetHeight-20;
}
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
if (ieversion>=8)
{alert("You're using IE8 or above");
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
else if (ieversion>=7)
{alert("You're using IE7.x");
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
else if (ieversion>=6)
{alert("You're using IE6");
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
else if (ieversion>=5)
{alert("You're using IE5");
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
}
linea="<style> body{ background-image:url('/descubriendo/background.php?anchoPantalla="+ /*window.screen.width*/ winW + "');}</style>";
document.write(linea);
document.body.style.background="url('/descubriendo/background.php?anchoPantalla="+ window.screen.width + "');"
}
Debug data:
