PDA

View Full Version : Question with document.write in javascript


Rickard19
03-14-2003, 02:41 AM
Hello,

I was recently experimenting with the document.write with in my webpage. This is what I have done so far.

<script language="javascript">
document.write("<noscript>");
document.write("</noscript">);
</script>

I'm placing this after the </head> and right before the <body> tag. When I place it there all I see written on the webpage is

"); document.write(" or
"); document.write("");

Do I have the syntax wrong for wanting to write out multiple document.write statments.

Also this has to be put after the </head> but before the <body> tag.

Thanks very much for your time and assistance. It is very much appriciated.

Rich

Borgtex
03-14-2003, 10:24 AM
lol. writing <noscript> tag with javascript it's a self-contradiction. :)

arnyinc
03-14-2003, 01:16 PM
The end quote is off by a space. It needs to be to the right of your bracket
document.write("</noscript"> );

Like Borg mentioned, this code will never execute for anybody. Maybe if they load the page then turn off javascript?

paulstreats
03-14-2003, 03:07 PM
You should be writing:

-document.write("<noscript>")
(put text where <noscript> is otherwise this hardcodes a <noscript> tag in html. also if you are using multiple lines of document.write() you could use the WITH command i.e.

with (document){
write("text")
write("text)
}

**the { and } are important as anything you put inbetween them is using the with command. all this does is stops you having to write document at the beginning of each write command by putting it into brackets next to with.

Also look where you are putting " these as you have one wrongly placed in your example.
:cool:
**one more thing, Borg was right completely, by putting <noscript> inside your write command will hard code <noscript> tag onto your page so it may turn off javascript and just dump the whole thing onto the page as text? if you know what i mean.

Rickard19
03-15-2003, 01:38 AM
Thank You guys for all your help. I really appriciate it :). When it comes to javascript. I'm a beginner and I'm still learning :). I didn't try the most recent postings yet, because I tried one more thing before I checked my mail and read the most current posts.

I just put everything into a single document.write.

The point of the document.write("<noscript>") was to write out the tag to the webpage between the </head> and the <body>.

The person I'm doing a webpage for wanted them there. Even though I know they don't go there. They could, but I'm not going to argue. There's no point. As they say "The Customer is always right". Cause no matter what I say she'll still want it inplimented within her site.

But I almost died when she mentioned the <invisible></invisible> tags. LOL, but that's another story.

Thanks a bunch for your time and support. Have a good weekend

Rich