How do I get the text where I want it ?

H

H

Ok, so I have a table, and after that I want a javascript to print some
things, but my printing comes up in the table. How do I get it after the
table, in the "normal" position ?

This is my code

<body>
<table border="1" width="80%" style="z-index: 1; position: absolute;
left:10px">
Some rows and columns

</table>
<p style="z-index: 0">Some info about your browser....</p>

<script language="Javascript" >
<!--
// This is the text I want after the table .....
document.writeln("You're using : " + navigator.appName + " " +
navigator.appVersion +");
//-->
</script>
</body>

</html>
 
M

Matthias Gutfeldt

H said:
Ok, so I have a table, and after that I want a javascript to print some
things, but my printing comes up in the table. How do I get it after the
table, in the "normal" position ?

This is my code

<body>
<table border="1" width="80%" style="z-index: 1; position: absolute;
left:10px">

position:absolute removes the table from the normal flow and doesn't
affect the layout of any other elements. Those other elements will just
pretend the table doesn't even exist. So you have to make sure that the
space where you're moving your table to is actually empty.

It's all explained in the CSS2 specification:
<http://www.w3.org/TR/CSS2/visuren.html#propdef-position>

Why do you need to position that table, anyway ?


document.writeln("You're using : " + navigator.appName + " " +
navigator.appVersion +");

Doh. That's about as useful as telling me the colour of my T-Shirt ;-).


Matthias
 
D

David Dorward

H said:
Ok, so I have a table, and after that I want a javascript to print some
things, but my printing comes up in the table. How do I get it after the
table, in the "normal" position ?

This is my code

<body>
<table border="1" width="80%" style="z-index: 1; position: absolute;
left:10px">

Position absolute takes the table out of the normal document flow. You need
to create a space for it to sit in through other techniques (or get rid of
the directive to position absolutely)
Some rows and columns

</table>
<p style="z-index: 0">Some info about your browser....</p>

z-index doesn't apply to elements which aren't positioned, and some browsers
have trouble with z-indexes < 1.
<script language="Javascript" >

Why are you using HTML 3.2? For that matter, I don't think HTML 3.2 had a
style attribute, so this is invalid HTML.

<!--
// This is the text I want after the table .....
document.writeln("You're using : " + navigator.appName + " " +
navigator.appVersion +");

I rather suspect that the user will know this already - and what if they
don't have JavaScript enabled. If you must generate content with
JavaScript, then generate all the relevent content (i.e. document.write the
 
H

H

Matthias Gutfeldt said:
position:absolute removes the table from the normal flow and doesn't
affect the layout of any other elements. Those other elements will just
pretend the table doesn't even exist. So you have to make sure that the
space where you're moving your table to is actually empty.
Ok, I just wondered if there was any way to "start" the normal flow again,
AFTER the table.
Why do you need to position that table, anyway ?
I need some text in a layer to cover some of the test in the table, thats
the only way of making it I came up with ..
Doh. That's about as useful as telling me the colour of my T-Shirt ;-).
Haha yep, I know, but sometimes you may just forget what color it is ...
 
H

H

Position absolute takes the table out of the normal document flow. You need
to create a space for it to sit in through other techniques (or get rid of
the directive to position absolutely)


z-index doesn't apply to elements which aren't positioned, and some browsers
have trouble with z-indexes < 1.
If I get rid of the absolute position, then how could I get a layer, (that
shall be absolutely positioned in my task) to cover some of the text in the
table ?
Why are you using HTML 3.2? For that matter, I don't think HTML 3.2 had a
style attribute, so this is invalid HTML.
I am ? This is the way my book tells me to write it, and the way the editor
autocompletes it, so I figured that if they both says the same thing, they
may be on to something.

I rather suspect that the user will know this already - and what if they
don't have JavaScript enabled. If you must generate content with
JavaScript, then generate all the relevent content (i.e. document.write the
<p>Some info about your browser....</p> too.)

Yes, I know. but it all started out as a school task, and I decided to keep
that, just to show what I meant with "continuing the flow"
 
R

rf

Ok, I just wondered if there was any way to "start" the normal flow again,
AFTER the table.

The normal flow *is* "started". It never stopped. It's just that the table
is taken out of the normal flow.

Do it the other way round. Leave the table in the normal flow and absolutely
position the text over the top of the table.

Cheers
Richard.
 
H

H

rf said:
The normal flow *is* "started". It never stopped. It's just that the table
is taken out of the normal flow.

Do it the other way round. Leave the table in the normal flow and absolutely
position the text over the top of the table.
AHH! So perfectly clear !! Can't believe I didn't think of that one ....

Anyways, Thanks for all the answers sofar !!!
I have a feeling more questions will be coming ....
 
D

David Dorward

H wrote:

If I get rid of the absolute position, then how could I get a layer, (that
shall be absolutely positioned in my task) to cover some of the text in
the table ?

Then you need to be more careful with your positioning. Probably by creating
I am ? This is the way my book tells me to write it

Wonderful another book with mistakes in it.
, and the way the editor autocompletes it,
s/book/editor

so I figured that if they both says the same thing, they may be on to
something.

On to a time machine back to 1994
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top