cgi / javascrip / perl / innerHTML quoting confusion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • seven.reeds

    cgi / javascrip / perl / innerHTML quoting confusion

    Hi,

    I am not a js expert by any stretch and this might be a perl question
    more than js but I have to start somewhere so fingers crossed...

    Ok, I am doing some ajax and have this '<input type='file"' input that
    I am working on. It is accepting image files. When its value changes
    I want to display the image in an associated DIV. I am building the
    html and js lines in a perl script. THe relevant section looks like:

    $HTML .= <<EOF;
    <p><label for="IThumbnail ">Path to Thumbnail</label>
    <input type="file" name="IThumbnai l" id="IThumbnail "
    size=50
    accept="image/gif,image/jpeg"
    onchange="
    document.getEle mentById('IThum bnailImageDiv') .innerHTML
    =
    '<img src="file://' +
    document.getEle mentById('IThum bnail').value +
    '" alt="upload file" />'; return false; " /></p>

    <div id="IThumbnailI mageDiv"
    style="float:le ft;
    clear:both;">
    </div>
    EOF

    I'm testing this with FireFox and have the js Console open. It tells
    me that there are mis-matching quotes starting at: '<img

    I have tried quoting the double qyotes inside the IMG tag I am building
    with "\" and "\\" but neither works. This has to be a simple mistake
    but I am not seeing it.

    help?

  • Randy Webb

    #2
    Re: cgi / javascrip / perl / innerHTML quoting confusion

    seven.reeds said the following on 6/20/2006 3:45 PM:[color=blue]
    > Hi,
    >
    > I am not a js expert by any stretch and this might be a perl question
    > more than js but I have to start somewhere so fingers crossed...
    >
    > Ok, I am doing some ajax and have this '<input type='file"' input that
    > I am working on. It is accepting image files. When its value changes
    > I want to display the image in an associated DIV.[/color]

    Your script error aside, you won't be able to do what you are trying to
    do anymore. It has been decided that showing an image from the client
    file system on a web-based page is a security violation so you can't do it.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • seven.reeds

      #3
      Re: cgi / javascrip / perl / innerHTML quoting confusion

      > Your script error aside, you won't be able to do what you are trying to[color=blue]
      > do anymore. It has been decided that showing an image from the client
      > file system on a web-based page is a security violation so you can't do it.[/color]

      Thanks Rand,

      it figures. sigh

      all the best

      Comment

      Working...