Z
zero0x
hi all,
i'm trying to create something like window in javascript.
there is no problem in firefox, but in microsoft internet explorer i
get "Unknown error while working" (this message is in slovak language,
and i has translated it, so maybe in english version it differs). when
i comment this line:
tab.innerHTML="test";
everything works ok. i have really no idea, what could be wrong.
here is the code listing
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<script>
function center(obj)
{
//function that centers object obj
owidth=obj.offsetWidth;
oheight=obj.offsetHeight;
pwidth=document.body.clientWidth;
pheight=document.body.clientHeight;
pleft=(pwidth-owidth)/2;
ptop=(pheight-oheight)/2;
//presunut objekt
cleft=pleft+"px";
ctop=ptop+"px";
obj.style.position="absolute";
obj.style.left=cleft;
obj.style.top=ctop;
}
function nwin(text)
{
var okinko="<tr><td width=\"15\" height=\"17\"
background=\"images/panel_03.jpg\"></td><td height=\"17\"
background=\"images/panel_04.jpg\"></td><td width=\"15\" height=\"17\"
background=\"images/panel_05.jpg\"></td></tr><tr><td width=\"15\"
background=\"images/panel_07.jpg\"></td><td
background=\"images/panel_08.jpg\">"+text+"</td><td width=\"15\"
background=\"images/panel_09.jpg\"></td></tr><tr><td width=\"15\"
height=\"16\" background=\"images/panel_11.jpg\"></td><td height=\"16\"
background=\"images/panel_12.jpg\"></td><td width=\"15\" height=\"16\"
background=\"images/panel_13.jpg\"></td></tr>"; //this variable
contains everything inside table
tab=document.createElement("table"); //i create the table
tab.innerHTML=okinko; // !!! here is the problem !!!
tab.setAttribute("cellspacing",0);
document.body.appendChild(tab); //append table to body
center(tab); //this function put my table into center of document
}
</script>
</head>
<body>
<a href="#"
onclick="nwin('aaaaaaaaaaaa<br>aaaaaaaaaa<br>aaaaaaaaaaaaaaa');return
false;">aaa</a>
<hr />
</body>
</html>
i'm trying to create something like window in javascript.
there is no problem in firefox, but in microsoft internet explorer i
get "Unknown error while working" (this message is in slovak language,
and i has translated it, so maybe in english version it differs). when
i comment this line:
tab.innerHTML="test";
everything works ok. i have really no idea, what could be wrong.
here is the code listing
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<script>
function center(obj)
{
//function that centers object obj
owidth=obj.offsetWidth;
oheight=obj.offsetHeight;
pwidth=document.body.clientWidth;
pheight=document.body.clientHeight;
pleft=(pwidth-owidth)/2;
ptop=(pheight-oheight)/2;
//presunut objekt
cleft=pleft+"px";
ctop=ptop+"px";
obj.style.position="absolute";
obj.style.left=cleft;
obj.style.top=ctop;
}
function nwin(text)
{
var okinko="<tr><td width=\"15\" height=\"17\"
background=\"images/panel_03.jpg\"></td><td height=\"17\"
background=\"images/panel_04.jpg\"></td><td width=\"15\" height=\"17\"
background=\"images/panel_05.jpg\"></td></tr><tr><td width=\"15\"
background=\"images/panel_07.jpg\"></td><td
background=\"images/panel_08.jpg\">"+text+"</td><td width=\"15\"
background=\"images/panel_09.jpg\"></td></tr><tr><td width=\"15\"
height=\"16\" background=\"images/panel_11.jpg\"></td><td height=\"16\"
background=\"images/panel_12.jpg\"></td><td width=\"15\" height=\"16\"
background=\"images/panel_13.jpg\"></td></tr>"; //this variable
contains everything inside table
tab=document.createElement("table"); //i create the table
tab.innerHTML=okinko; // !!! here is the problem !!!
tab.setAttribute("cellspacing",0);
document.body.appendChild(tab); //append table to body
center(tab); //this function put my table into center of document
}
</script>
</head>
<body>
<a href="#"
onclick="nwin('aaaaaaaaaaaa<br>aaaaaaaaaa<br>aaaaaaaaaaaaaaa');return
false;">aaa</a>
<hr />
</body>
</html>