Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- From: Richard <richardchaven@xxxxxxxxx>
- Date: Fri, 24 Aug 2007 18:16:32 -0700
1. Do you mean the 'scr' + 'ipt' thing? I had some browser get
confused and end the real script tag once. Perhaps it is unnecessary
these days.
2. The goal is to sometimes embed the <img> and sometimes embed the
<script>.
3. I have to do it this way because I do not own script.js; I cannot
control what it does, and currently, it does a document.write(). If I
want to use it based on a JavaScript value, I have to do this nested
document.write weirdness processing at page parse-time. I would prefer
to use div.innerHTML = ..., but as the external script returns
"document.write(...)", that is not an option.
4. Why XHTML? XML editors prefer it, and they will tell me if I am
missing something. While 90% of the web might not know what it is,
they do not seem to mind it.
Cheers
On Aug 24, 5:23 pm, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
Richard said the following on 8/24/2007 6:10 PM:
<div id="right" >
<script type="text/javascript">
if (IsThis)
document.write('<img src="images/foo.gif" />');
else
{
document.write('<div id="too_right"><scr' + 'ipt type="text/
javascript" src="http://external.com/script.js"></scr' + 'ipt></
div>');
What is with all that voodoo scripting by breaking up tags that have no
bearing on what it was attempting to do rather than breaking up the
sequence that should be broken up?
document.write('<script type="text/javascript"
src="someFile.js"><\/script>')
}
</script>
</div>
Now here's the good part:http://external.com/script.jsreturns (wait
for it) 'document.write("<img src="..." />");'
Then why not just write the image tag anyway? Or, is the src attribute
different?
if (!IsThis){document.write('<div id="too_right">')}
document.write('<img src="images/foo.gif">');
if (!IsThis){document.write('</div>')}
And for crying out loud, stop using XHTML on the web. Especially when
90% or so of the web doesn't even know what it is.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
.
- Follow-Ups:
- References:
- Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- From: Richard
- Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- From: Randy Webb
- Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- Prev by Date: Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- Next by Date: Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- Previous by thread: Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- Next by thread: Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?
- Index(es):
Relevant Pages
|