webForumDet fria alternativet

Få denna kod att fungera i IE

JavaScript

1 svar · 186 visningar · startad av icaaq

Medlem sedan okt. 20005 273 inlägg
Frågan#1

Tjenare alla...
jag har denna kod

[red]
function imgPopup4(url){
				MyWin = window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100");
				with(MyWin.document){
				open();
				write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n")
				write("<html>\n<head>\n<scr"+"ipt type=\"text\/javascript\">\n");
				write("<!--\n");
				write("window.onresize=function(){if(document.getElementById){\ndocument.getElementById('myimg').style.width=(document.all)?document.body.clientWidth:window.innerWidth;\ndocument.getElementById('myimg').style.height=(document.all)?document.body.clientHeight:window.innerHeight;\n}}\n");
				write("awidth=(document.layers)?0:8;awidth+=(document.all)?4:0;aheight=(document.layers)?0:29;\n");
				write("window.onload=function(){ window.resizeTo(document.images[0].width+awidth,document.images[0].height+aheight); window.moveTo(parseInt(screen.width/2-document.images[0].width/2),parseInt(screen.height/2-document.images[0].height/2));\n");
				write("if(document.all) document.all['wait'].style.visibility='hidden';\n");
				write("if(document.layers) document.layers['wait'].visibility='hide';\n");
				write("if(document.getElementById) document.getElementById('wait').style.visibility='hidden';\n");
				write("}\n-->\n<\/scr"+"ipt>\n");
				write("<title>Bildvisare<\/title>\n<\/head>\n<body style=\"overflow:hidden;\">\n");
				write("<div id='wait' style='position:absolute;top:0px;left:0px;width:100px;height:100px;color:white;font:bold 12px Arial;'><p>Vänta...<br\/>Bilden laddas<\/p><\/div>\n");
				write("<img id='myimg' src=\""+url.replace(/&/g, "&amp;")+"\" alt=\"bildvisning\"\/>\n");
				write("<\/body>\n<\/html>\n");
				close();
				}
			}
			-->
		</script>
[/red]

Och den skapar denna kod

[red]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript">
<!--
window.onresize=function(){if(document.getElementById){
document.getElementById('myimg').style.width=(document.all)?document.body.clientWidth:window.innerWidth;
document.getElementById('myimg').style.height=(document.all)?document.body.clientHeight:window.innerHeight;
}}
awidth=(document.layers)?0:8;awidth+=(document.all)?4:0;aheight=(document.layers)?0:29;
window.onload=function(){ window.resizeTo(document.images[0].width+awidth,document.images[0].height+aheight); window.moveTo(parseInt(screen.width/2-document.images[0].width/2),parseInt(screen.height/2-document.images[0].height/2));
if(document.all) document.all['wait'].style.visibility='hidden';
if(document.layers) document.layers['wait'].visibility='hide';
if(document.getElementById) document.getElementById('wait').style.visibility='hidden';
}
-->
</script>
<title>Bildvisare</title>
</head>
<body style="overflow:hidden;">
<div id='wait' style='position:absolute;top:0px;left:0px;width:100px;height:100px;color:white;font:bold 12px Arial;'><p>Vänta...<br/>Bilden laddas</p></div>
<img id='myimg' src="http://localhost/catering/image.aspx?path=/catering/productimages/popupfestbricka.jpg&amp;Size=500&amp;quality=80" alt="bildvisning"/>
</body>
</html>
[/red]

Men nu till mitt problem, den funkar inte i IE. Popupen bara står och tuggar.

I FireFox funkar det perfekt.

mv icaaq

Medlem sedan okt. 20005 273 inlägg
#2

Det är alltså denna kod som jag ändrat lite i
http://www.jojoxx.net/jscript/archive/show.asp?id=75
mv icaaq

257 ms totalt · 4 externa anrop · v20260731065814-full.6fe65c25
126 ms — deklarationer (db)
0 ms — hämta statistik (cache)
128 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)