473,410 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

document.write() line being ignored..

<tabletag is being ignored here.. why is this..
<div id="img1">

<script type="text/javascript" language="JavaScript">
var cw = document.body.clientWidth;
var ch = document.body.clientHeight;
document.write("<table border=1 cellpadding=0
cellspacing=0 width=100% height=" + ch-80 + ">");
</script>

<tr><td height=80 colspan=2>&nbsp;</td></tr>
<tr><td width=135>&nbsp;</td><td align=center>
<img src="images/img1.jpg" width="718" height="480" alt="">
</td></tr></table>

</div>
thank you...

Aug 2 '06 #1
6 3918
maya said the following on 8/1/2006 10:56 PM:
<tabletag is being ignored here.. why is this..
Because it doesn't get written as you think it does.
>
<div id="img1">

<script type="text/javascript" language="JavaScript">
var cw = document.body.clientWidth;
var ch = document.body.clientHeight;
document.write("<table border=1 cellpadding=0
cellspacing=0 width=100% height=" + ch-80 + ">");
alert(ch);//gives 0 so how can a table have a width of -80?

The reason it gives me 0 is at the time the table is being written, the
body has not content so its height is - 0.

Change it to height=100px and watch your table.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 2 '06 #2
Randy Webb wrote:
maya said the following on 8/1/2006 10:56 PM:
><tabletag is being ignored here.. why is this..

Because it doesn't get written as you think it does.
>>
<div id="img1">

<script type="text/javascript" language="JavaScript">
var cw = document.body.clientWidth;
var ch = document.body.clientHeight;
document.write("<table border=1 cellpadding=0
cellspacing=0 width=100% height=" + ch-80 + ">");

alert(ch);//gives 0 so how can a table have a width of -80?

The reason it gives me 0 is at the time the table is being written, the
body has not content so its height is - 0.

Change it to height=100px and watch your table.....
thank you Randy... so by the time that JS code (inside <body>) is
executing JS still doesn't know what the dimensions are of
document.body.clientHeight.... wild..

so I tried this:

window.onload=document.write("<table border=1 cellpadding=0
cellspacing=0 width=100% height=" + ch-80 + ">");

but it still doesn't work... how can I then say ok, run this code ONLY
once you know how tall browser window is....:)

thanks again..

Aug 5 '06 #3
Hint:
var cw = document.body.clientWidth +"px";
var ch = document.body.clientHeight +"px";
Did you try this way ?
maya написа:
Randy Webb wrote:
maya said the following on 8/1/2006 10:56 PM:
<tabletag is being ignored here.. why is this..
Because it doesn't get written as you think it does.
>
<div id="img1">

<script type="text/javascript" language="JavaScript">
var cw = document.body.clientWidth;
var ch = document.body.clientHeight;
document.write("<table border=1 cellpadding=0
cellspacing=0 width=100% height=" + ch-80 + ">");
alert(ch);//gives 0 so how can a table have a width of -80?

The reason it gives me 0 is at the time the table is being written, the
body has not content so its height is - 0.

Change it to height=100px and watch your table.....

thank you Randy... so by the time that JS code (inside <body>) is
executing JS still doesn't know what the dimensions are of
document.body.clientHeight.... wild..

so I tried this:

window.onload=document.write("<table border=1 cellpadding=0
cellspacing=0 width=100% height=" + ch-80 + ">");

but it still doesn't work... how can I then say ok, run this code ONLY
once you know how tall browser window is....:)

thanks again..
Aug 5 '06 #4
Georgi Naumov said the following on 8/5/2006 6:09 PM:
Hint:
Hint: It still won't work. Try re-reading my reply and comprehending
what it says.
var cw = document.body.clientWidth +"px";
var ch = document.body.clientHeight +"px";
Did you try this way ?
And if document.body.clientWidth is 0 it *still* won't work.

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 5 '06 #5
Sorry from my bad english. I don't know the laws in this place. I'm
sorry if i make error.
Randy Webb написа:
Georgi Naumov said the following on 8/5/2006 6:09 PM:
Hint:

Hint: It still won't work. Try re-reading my reply and comprehending
what it says.
var cw = document.body.clientWidth +"px";
var ch = document.body.clientHeight +"px";
Did you try this way ?

And if document.body.clientWidth is 0 it *still* won't work.

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 5 '06 #6
Georgi Naumov wrote:
Hint:
var cw = document.body.clientWidth +"px";
var ch = document.body.clientHeight +"px";
Did you try this way ?
yes, I did, Georgi, thank you.. (actually not sure you need "px" in
there because for table height in html you don't have to specify px..
error was of different nature..

I actually have two of these,
<script type="text/javascript" language="JavaScript">
var cw = document.body.clientWidth;
var ch = document.body.clientHeight-100;
document.write('<div id="thumbs" style="height:' + ch + ';">');
/* rest of styles for this div in header, good to know you can split
css code like that, like this you put only props whose values are vars
in here....:)
</script>

<script type="text/javascript" language="JavaScript">
var cw = document.body.clientWidth;
var ch = document.body.clientHeight-80;
document.write('<table border=0 cellpadding=0 cellspacing=0 width="100%"
height=' + ch + '>');
</script>

the first one never gave me hard time, only the second one did because
I had it only once instead of putting it into each div...:) and this
one is of divs that show up and disappear dynamically..) thank you very
much...

thank you again.......

-m


Aug 6 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: dan glenn | last post by:
Hi. I'm finding that if I have text entered into a <textarea ...> </textarea> in a form, and that text has leading blank lines (with no spaces or anything else), that when I retrieve the entered...
4
by: Yvan J. Gagnon | last post by:
I am encountering a strange problem in Netscape 7 with a CFM file I am trying to troubleshoot (the page is working fine in NS Communicator and IE). Below is a sample of the problematic line of...
11
by: Ken | last post by:
How do I force the text generated by a document.write command to wrap after a specified number of characters? Thanks for the help.
1
by: Kevin Potter | last post by:
We have an application that has been running on IIS4 and IIS5 for quite some time, without problem We're now migrating to IIS6 (windows/2003), and have run into a what might? be a Javascipt...
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
17
by: rox.scott | last post by:
Can someone please explain why this happens? The expected output is 3, but uncommenting line 7 makes the output 0. Why ??? VB.NET code: ** note the commented line, this is the culprit ** Dim...
6
by: john.lum | last post by:
I am using document.write in an external javascript file to display some content, but I've found that I can't rely on that content being displayed in the location I expect. Here's a very simple...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.