---
title: "Få denna kod att fungera i IE"
type: "forum-thread"
url: "https://www.webforum.nu/amne/javascript/115441-få-denna-kod-att-fungera-i-ie"
topic: "JavaScript"
topic_url: "https://www.webforum.nu/amne/javascript"
author: "icaaq"
published: "2004-11-08T20:46:08.000Z"
updated: "2004-11-09T20:54:34.000Z"
replies: 1
views: 188
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/javascript/115441-få-denna-kod-att-fungera-i-ie"
---

# Få denna kod att fungera i IE

## #1 — icaaq, 2004-11-08T20:46Z

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

Permalänk: https://www.webforum.nu/p/115441

## #2 — icaaq, 2004-11-09T20:54Z

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

Permalänk: https://www.webforum.nu/p/1481655

---

Tråden på webben: https://www.webforum.nu/amne/javascript/115441-få-denna-kod-att-fungera-i-ie
