Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> Ver Pdf </title>
  5. </head>
  6. <body>
  7.  
  8. <!-- Formulário -->
  9. <form name = "form1">
  10. <input type="text" name="file" size="40" placeholder="Insira o caminho do documento!">
  11. <br>
  12. <br>
  13. <input type="submit" onclick="VerPdf();" style="width: 200px; height: 100px" value = "Ver Pdf">
  14. </form>
  15.  
  16. <!-- JavaScript -->
  17. <script type="text/javascript">
  18. function VerPdf()
  19. {
  20. //Ficheiro pretendido
  21. var ficheiro = form1.file.value;
  22. //Contar tamanho da String
  23. var total = ficheiro.length;
  24. //Ver últimos 4 caracteres
  25. var tipo = ficheiro.substring(total - 4, total);
  26. if (tipo == '.pdf') {
  27. window.open(ficheiro);
  28. }
  29. else {
  30.  
  31.  
  32.  
  33. }
  34. }
  35. </script>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement