Re: Double-document.write('<scr'+'ipt>...) insert <br>-like space?



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/


.



Relevant Pages

  • Re: RFD: How To Recognize Bad Javascript Code
    ... Elements consist of tags ... Your example `script' elements are empty where they should have ... | Using the pseudo-protocol javascript in the href is never valid. ... Some web developers use this to work ...
    (comp.lang.javascript)
  • Re: Help-Need confirmation page email address to be assigned to a javascript variable - Stuc
    ... I have tried that and just awaiting results from the tracking company...but ... as you say the problem lies in the statement between the no script tags ... JavaScript - and JavaScript is not available if a tag is ...
    (microsoft.public.frontpage.programming)
  • RE: Can I use more than one style in a treeview control at the roo
    ... // Check to see if the startup script is already registered. ... > Also if Microsoft changes the format in which ASP.NET composes the ClientID ... > in another version then your Javascript will not work. ... > I recommended in my previous post adding an enclosing div tag to avoid ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Double-document.write(...) insert
    -like space?

    ... What is with all that voodoo scripting by breaking up tags that have no ... Then why not just write the image tag anyway? ... It isn't the word script that ends it, it is the character sequence </ that can end it - it is up to the browser. ... want to use it based on a JavaScript value, I have to do this nested ...
    (comp.lang.javascript)
  • VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
    ... Job is to convert that JAVASCRIPT code into SIMPLE VBA code ... Here's a bookmarklet that will tell you whether or not the browser ... JS sends request to the server (to a PHP script) ... This is the PHP script. ...
    (microsoft.public.vb.controls.internet)