Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title> Ver Pdf </title>
- </head>
- <body>
- <!-- Formulário -->
- <form name = "form1">
- <input type="text" name="file" size="40" placeholder="Insira o caminho do documento!">
- <br>
- <br>
- <input type="submit" onclick="VerPdf();" style="width: 200px; height: 100px" value = "Ver Pdf">
- </form>
- <!-- JavaScript -->
- <script type="text/javascript">
- function VerPdf()
- {
- //Ficheiro pretendido
- var ficheiro = form1.file.value;
- //Contar tamanho da String
- var total = ficheiro.length;
- //Ver últimos 4 caracteres
- var tipo = ficheiro.substring(total - 4, total);
- if (tipo == '.pdf') {
- window.open(ficheiro);
- }
- else {
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement