OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <body> | |
3 | |
4 <button id="link1" onclick="openPdf()">Click me to load pdf</button> | |
5 <div id="div1"></div> | |
lazyboy
2017/05/17 16:34:44
nit:s/div1/container (in both html)
Wei Li
2017/05/18 23:25:28
Done.
| |
6 | |
7 <script> | |
8 function openPdf() { | |
9 var frame = document.createElement("embed"); | |
lazyboy
2017/05/17 16:34:44
Since this is not a frame, call it embedElement or
Wei Li
2017/05/18 23:25:28
Done.
| |
10 frame.src = "test.pdf"; | |
11 var outter_element = document.getElementById("div1"); | |
lazyboy
2017/05/17 16:34:44
nit: outerElement (also applies to other file).
Wei Li
2017/05/18 23:25:28
Done.
| |
12 outter_element.appendChild(frame); | |
13 } | |
14 </script> | |
15 | |
16 <body> | |
17 </html> | |
OLD | NEW |