html5 - javascript. Show embeded pdf on click -
when click link "show pdf" want display embeded pdf. there must wrong. pdf load. help?
check out fiddle: http://jsfiddle.net/benjones337/7jkmvll9/2/
<!doctype html> <html lang="en"> <head> <link rel="stylesheet" type="text/css" href="style.css"> <meta charset=utf-8 /> <script type="text/javascript"> window.onload = function() { document.getelementbyid("showpdf").onclick = function() { document.getelementbyid("thepdf").style.visibility = "visible"; } } </script> </head> <body> <div> <object data="http://www.elml.org/website/en/download/gitta_databases.pdf" type="application/pdf"> <embed id="thepdf" src="http://www.elml.org/website/en/download/gitta_databases.pdf" width="700" height="575" type="application/pdf" /> </object> <p><a id="showpdf">show pdf</a></p> </div> </body> </html>
avoid using onload event in jsfiddle event happened when page "loaded".
hide object (i moved id parent element) embed element not affected style.
jsfiddle.net/7jkmvll9/6/