I want to run this javascript after clicking an image.

Discussion in 'HTML & Website Design' started by pidge1992, Jul 1, 2011.

  1. #1
    Hey Guys

    you must be heard about facebook share button.

    And I got a code which help my users to share the stuff with their friends.

    Here is the code below :

    <fb:share-button class="url" href="http://facebook.com/
    Anti.Social.Development" />


    But I want something like that when someone clicks on an image, this script get runs.

    Hmmm, that image is may be this

    http://myadfirst.com/images/sm/FB-share.png

    I am not really good at java scripts yet so anyone can please help me out.

    Like I want something like when someone click that button (image) that javascript get runs on the SAME PAGE ! So that the same page data gets shared and nothing else.

    Waiting for reply.

    Thanks
     
    pidge1992, Jul 1, 2011 IP
  2. shiva0077

    shiva0077 Peon

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    sorry dear i don't know.
     
    shiva0077, Jul 2, 2011 IP
  3. MarPlo

    MarPlo Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    48
    #3
    Hy,
    Try to add that code in a hidden box:
    <div id="dvh" style="display:none;"><fb:share-button class="url" href="http://facebook.com/
    Anti.Social.Development" /></div>
    Code (markup):
    Then, when you click the image, shows that DIV:
    <img src="image.jpg" alt="Title" onclick="document.getElementById('dvh').style.display='block';" />
    Code (markup):
     
    MarPlo, Jul 2, 2011 IP
  4. pidge1992

    pidge1992 Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hey Bro

    yhs for your reply but I m getting this error after applying your codes :

    Parse error: syntax error, unexpected T_STRING

    waiting for ur reply on that.

    thx :)
     
    pidge1992, Jul 3, 2011 IP