Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with dynamically writing to ilayers

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
written a simple piece of script that simply calculates to values and then spits the total out into ilayer in NS it all work fine but NS does not show the total if you resize the window it does but otherwise not. Work fine if im using plaing layers but I want to position relatively no absolute wsup with this anyone?

feel free to look at the url below

 
I have a similar problem with Tables and DIV.

I put a DIV element in the table as follows:
<td><DIV class=someClass ID=&quot;total&quot;></DIV></td>

Then, I attempt to change the value of the table cell in Netscape as:
document.layers[&quot;total&quot;].document.write(result);

The table cell containing the DIV does get refreshed, but the value doesn't show up. By refreshed, I mean that the background color changes as per the width of the new total, but the characters do not show up. If I resize the window however, the characters show up. Any help would be greatly appreciated.
 
CLOSE YOUR DOCS
i often had that, don't know if it's really your case but after document.write(&quot;anything&quot;), i usually need to add document.close() in order to see things written

 
I'm sorry I left out the details... Here is a simple code that can re-produce the problem (it is NS specific).

<HTML>
<HEAD>
<TITLE>DIV & Tables...</TITLE>

<STYLE TYPE=&quot;text/css&quot;>
.tc {position:relative; layer-background-color:yellow;}
</STYLE>

<SCRIPT language=&quot;JavaScript&quot;>

function setTotal(val) {
document.layers[&quot;total&quot;].document.open();
document.layers[&quot;total&quot;].document.write(val);
document.layers[&quot;total&quot;].document.close();
}

</SCRIPT>

<table border=&quot;1&quot; bgcolor=&quot;Silver&quot;>
<th>Total</th>
<tr>
<td><DIV class=&quot;tc&quot; ID=&quot;total&quot;>???</DIV></td>
</tr>
</table>

<FORM name=form1>
<INPUT type=&quot;text&quot; name=&quot;txt1&quot;>
<INPUT type=&quot;button&quot; name=&quot;btn1&quot; value=&quot;Enter new total and click here&quot; onClick=&quot;setTotal(document.form1.txt1.value)&quot;>
</FORM>

</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top