Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > How do I get the text where I want it ?

Reply
Thread Tools

How do I get the text where I want it ?

 
 
H
Guest
Posts: n/a
 
      11-19-2003
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>



 
Reply With Quote
 
 
 
 
Matthias Gutfeldt
Guest
Posts: n/a
 
      11-19-2003
H schrieb:
>
> 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
 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      11-19-2003
H wrote:

> 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.

<script type="text/javascript">

> <!--
> // 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
<p>Some info about your browser....</p> too.)

> //-->
> </script>
> </body>
> </html>


--
David Dorward http://dorward.me.uk/
 
Reply With Quote
 
H
Guest
Posts: n/a
 
      11-19-2003

"Matthias Gutfeldt" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> H schrieb:
> >
> > 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.

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 ..

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

>
> 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 ...


 
Reply With Quote
 
H
Guest
Posts: n/a
 
      11-19-2003
> > <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.

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 ?

> > <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.

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.


> <script type="text/javascript">
>
> > <!--
> > // 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
> <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"


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      11-19-2003

"H" <(E-Mail Removed)> wrote in message
news:O1Tub.38479$(E-Mail Removed)...
>
> "Matthias Gutfeldt" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
> > H schrieb:
> > > <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.


> 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.


 
Reply With Quote
 
H
Guest
Posts: n/a
 
      11-20-2003

"rf" <(E-Mail Removed)> skrev i meddelandet
news:dcTub.18244$(E-Mail Removed)...
>
> "H" <(E-Mail Removed)> wrote in message
> news:O1Tub.38479$(E-Mail Removed)...
> >
> > "Matthias Gutfeldt" <(E-Mail Removed)> skrev i meddelandet
> > news:(E-Mail Removed)...
> > > H schrieb:
> > > > <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.

>
> > 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.
>

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 ....


 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      11-20-2003
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
another <div> around that content and making it position relative to act as
a new local positioning context.

>> 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


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

--
David Dorward http://dorward.me.uk/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to output all of my STDOUT to a single line....dont want to scroll seancsnyder@gmail.com Perl Misc 4 09-13-2006 04:32 PM
I want to create a link "e-mail this page to a friend" on clicking this link i want to send the URL of that current page to a friend pavi Javascript 0 01-13-2006 12:10 PM
Controlling text in a Text Area or Text leo ASP General 1 12-05-2005 01:13 AM
Hi I have one web application and i want to get the number of users who are currently accessing the application. Also I want to get the user details of each user, which is stored in a database. How can I do this? Pls help. Getting No: and anu Java 11 05-12-2005 03:25 PM



Advertisments