SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Bethesda, MD
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    one more simple question...

    I need to use the document.write command to print this:

    <a href='javascript:image("linkgoeshere")' onClick='image("linkgoeshere");return false'>open</a>

    The problem is that I dont know how to work the code around the way the document.write works because I need both " and ' for that to work right. (with the (' starting and ') closing the document.write command).

    Not only do I need to be able to do that, but I need to print "linkgoeshere" with a variable from a script. I think it should be something like "' + link + '", but I'm not sure.

    After stumbling my way through a project the past couple weeks, this seems to be the only thing left in my way.

    Thanks in advance...

  2. #2
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe this is what you want:

    Code:
    document.write('<a href=""\'javascript:image("' + linkgoeshere + '")\' onclick=\'image("' + linkgoeshere + '");return false\'>open</a>');
    Does that work?
    Wavelan

  3. #3
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Bethesda, MD
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It works perfectly. I would kiss you now if i could This has been one hell of a project and now it's done (well, at least the part that was holding me up)

    Thank you so much.

  4. #4
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're welcome, im glad everything is working for you.
    Wavelan


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •