Forum Moderators: open

Message Too Old, No Replies

is it legal to write open tag in script and left close tag in html?

works for all browsers?

         

Xuefer

4:13 pm on May 22, 2003 (gmt 0)

10+ Year Member



<script>
document.write('<a href="abc.html">');
</script>
aaaaah!
</a>

BlobFisk

4:50 pm on May 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It'll work fine for all JavaScript compliant browsers - but people browsing with JavaScript turned off won't see the link.

Another consideration is that since the link is in the script, I don't think that SE spiders can follow it. Your code won't validate, but it will work.

Xuefer

5:49 pm on May 22, 2003 (gmt 0)

10+ Year Member



then how about

<script>
document.write('<a href="abc.html">');
</script>
<noscript>
<a href="def.html">
</noscript>
aaaaah!
</a>

i know SE spiders can't follow it
but will SE spiders just ignore that </a>?

g1smd

9:42 pm on May 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wy can't you have the </a> inside the script as well?

If it is because the validator complains, then the solution is simply to escape it by using <\/a> instead.