#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0

    How to embed a document if press a link


    How can I do something like show an embed document if a link is press.

    The logic would be something like:




    IF LinkPress then

    <embed src="\Document.pdf" width="720" height="500" >



    Being The link something like:

    <a href="">Link<a/>

    Thanks much
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    191
    Rep Power
    44
    You'll need more than HTML to accomplish this. Javascript or jQuery would work.

    Javascript Forum
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    24
    Rep Power
    0
    Ok,

    I have the following:

    <p>Link</p>

    <script>
    $("p").click(function () {
    $(this).showembed();
    });
    </script>


    Now, how can I do to tell when I press "Link" show the following document. "document.pdf"

    Something like:

    <p (\document.pdf)>Link</p>

    <script>
    var document
    $("p").click(function () {
    $(this).showembed(document,);
    });
    </script>

    So when I press the "Link" the document.pdf shows embed

    Thanks so much
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    191
    Rep Power
    44
    I'm sure you mean Javascript, as Java is something different. You should post your question again in the Javascript forum, which is what I linked you to.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    6
    Rep Power
    0
    You can embed a document as follow.
    jsfiddle[dot]net/kCdP5/
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    20
    Rep Power
    0
    Use html button and javascript onclick event to call the jquery function.

IMN logo majestic logo threadwatch logo seochat tools logo