Discussion: js write a <hr>
Afficher un message
Vieux 11/09/2007, 05h52   #1
Blinky the Shark
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut js write a <hr>

Can't for the life of me figure out how to get a hr into a js write.

http://blinkynet.net/humor/index.html

I'd like a *scripted* <hr> just before the first line created by the
fist little script do that it separates the quote of the day from the
page intro above it. The reason I want it to be part of the script is
so if scripts are disabled and the separator isn't needed, it's not
rendered. (The nonscripted <hr> *after* the quote of the day will be
all the separation I need between the intro and the list.)

I've been able to make this work just fine with "<hr />" being the first
element in the first document.write:

document.write("<hr />" + "foo")

But validation fails with a you-can't-use-a-<hr>-there error.

So I look at W3Schools, which I think I've seen recommended here for
tutorials -- I'm obviously new to js.

Barely into the js tute, I see:

<q>

A JavaScript statement like this: document.write("<h1>" + name +
"</h1>") can write a variable text into an HTML page

</q>

Now if they can get a <h1> in there, why can't I get a <hr> in, using the
same method? Yes, I tried it with and without closing tags. Validator
won't have anything do do with it.

Is there a *simple* way to do that I want? No, I'm not going to do
twelve lines of code for one hr.


--
Blinky RLU 297263
Killing all posts from Google Groups
The Usenet Improvement Project:
http://improve-usenet.org <----------- New Site Aug 28
  Réponse avec citation
 
Page generated in 0,05018 seconds with 9 queries