SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with maiking a string like I want it. :)

    Sorry for the lousy summary.

    this code:
    thumbContent = thumbContent + '<a href="javascript:viewPic('+ contact[i].ThumbnailUrl + ', ' + contact[i].Name + ', ' + contact[i].Description+ ')" ><img src="'+contact[i].ThumbnailUrl+'" border="0" width="134" height="78" /></a>';
    outputs this:

    <a href="javascript:viewTruck(http://server.com/deliveredImage/Thumbnail/476, Aerts Jan, Aerts Jan)"><img src="http://server.com/delivered/Image/Thumbnail/476" border="0" width="134" height="78"></a>

    But I want this for the javascript request to work:
    <a href="javascript:viewTruck("http://server.com/deliveredImage/Thumbnail/476", "Aerts Jan", "Aerts Jan")"><img src="http://server.com/delivered/Image/Thumbnail/476" border="0" width="134" height="78"></a>

    Send the data as strings.
    Can Anyone help me, brains not working.

    Thank you.

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JohnnyZipper View Post
    Can Anyone help me, brains not working.

    Thank you.
    Hah yes, mixing quotes can be painful. You'll probably want to use double quotes in the function call so you'll have to escape the single quotes around the attributes.

    e.g.
    Code:
    thumbContent = thumbContent + '<a href=\'javascript:viewPic("'+ contact[i].ThumbnailUrl + '", "' + contact[i].Name + '", "' + contact[i].Description+ '")\' ><img src="'+contact[i].ThumbnailUrl+'" border="0" width="134" height="78"    /></a>';
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much, and sorry for my late reply.


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
  •