• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

if link is clicked

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I do something like show an embed document if a link is press.

The logic would be something like:




Being The link something like:



Thanks much
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Samuel,
You'll need a JavaScript even handler to recognize the link was clicked.

One way is to hard code it:


The other way is to use a library like jQuery
see example. As your apps grow, it becomes more useful to not have JavaScript all over your codebase.

Either way, you then implement the JavaScript function to show the embedded content. You could even load it in a hidden div on page load and show it when that function is called.
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Jquery but i'm pretty much sure all browsers can handle document.getElementById() even IE 5.5 .
 
samuel marin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't embed a PDF inside an HTML document. So you'll either need to show it in the whole window, open a new window to show it, or embed an iframe element in which to show the PDF.
 
You didn't tell me he was so big. Unlike this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic