Discussion: js write a <hr>
Afficher un message
Vieux 11/09/2007, 13h00   #8
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: js write a <hr>

Blinky the Shark wrote:
> 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.
>
>


Are you sure it isn't just the validator not understanding js? Most
don't, and try to parse the js as html somehow. It doesn't mean the
page is invalid - just that the validator doesn't understand it.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
 
Page generated in 0,05979 seconds with 9 queries