Dragonfish
Programmer
I´m trying an exercise with <DIV> tags an getting some strange effects. The basic idea is to write no body-HTML-code at all. When opening the HTML-file with IE the are no error messages and the alert-box is loaded but the "DIV-boxes" are only opened after I press IE´s refresh button (IE5). Using NN4 the "DIV-boxes" are loaded but then I get a javascript error message "WriteToDivObjects is not defined." and the alert-box is not loaded. Can anybody tell me what´s going on - THANKS. Oh and just to round up the problem - can anybody tell me how to write text into the "DIV-boxes" (document.write....DIV ID=...Hallo World.... ). I need the exact syntax. You´d be amazed, although there are gigabytes of doc on the web I´ve never found the syntax for this basic function /different for IE and NN). Here are the files:
<html>
<head>
<title>hauptfenster</title>
<meta name="author" content="me">
<script language="JavaScript" src="main6.js" type="text/javascript"></script>
</head>
<body text="#FF0000" bgcolor="#FACB85" onLoad="TestWrite()">
</body>
</html>
And the external main6.js file:
function TestWrite()
{
DefineDivObjects();
WriteToDivObjects();
}
function DefineDivObjects()
{
document.write("<DIV ID='ParentOneDiv' STYLE='position: absolute; border: none; left: 10px; top: 50px; width: 400px; height: 200px; background-color :#FFFFFF; layer-background-color:#FFFFFF;'></DIV>"
;
document.write("<DIV ID='ParentTwoDiv' STYLE='position: absolute; border: none; left: 420px; top: 50px; width: 400px; height: 200px; background-color :#FFFFFF; layer-background-color:#FFFFFF;'></DIV>"
;
}
function WriteToDivObjects()
{
alert("Function ok."
;
}
Thanks again DavidinGermany
<html>
<head>
<title>hauptfenster</title>
<meta name="author" content="me">
<script language="JavaScript" src="main6.js" type="text/javascript"></script>
</head>
<body text="#FF0000" bgcolor="#FACB85" onLoad="TestWrite()">
</body>
</html>
And the external main6.js file:
function TestWrite()
{
DefineDivObjects();
WriteToDivObjects();
}
function DefineDivObjects()
{
document.write("<DIV ID='ParentOneDiv' STYLE='position: absolute; border: none; left: 10px; top: 50px; width: 400px; height: 200px; background-color :#FFFFFF; layer-background-color:#FFFFFF;'></DIV>"
document.write("<DIV ID='ParentTwoDiv' STYLE='position: absolute; border: none; left: 420px; top: 50px; width: 400px; height: 200px; background-color :#FFFFFF; layer-background-color:#FFFFFF;'></DIV>"
}
function WriteToDivObjects()
{
alert("Function ok."
}
Thanks again DavidinGermany