I have a problem with my pages after trying to put js in an external file it just stopped working, and I could not find the error so far.
Follow the codes
HTML
<script type="text/javascript" src="funcjs.js"></script>//dentro da tag head
<a href="javascript:showhide('login')" style="float:right;" >Login</a>//dentro da tag body
JS (inside the funcjs.js file)
Initially it was like this:
function showhide(id) {
var e = document.getElementById(id);
e.style.display = (e.style.display == 'inline') ? 'none' : 'inline';
}
but after researching and finding this: The HTML page is not" calling "JavaScript
stayed like this
showhide = function (id) {
var e = document.getElementById(id);
e.style.display = (e.style.display == 'inline') ? 'none' : 'inline';
}
When the 1 JS code was on the html page itself it was working normally, I did not make any changes to the html code after the change, is there anything wrong in the way I'm trying to call this function?
EDIT: FOLLOW THE HEAD OF THE COMPLETE CODE AS WELL AS DIV SHOWHIDE
HEAD
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no">
<link href='https://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script type="text/javascript" src="funcjs.js"></script>
<script src='https://www.google.com/recaptcha/api.js?hl=pt-BR'></script>
DIV
<div id="login" style="display:none;">
<form action="login.php" method="POST" enctype="multipart/form-data">
<p><input type="text" name="usuario" id="usuario" placeholder="Usuário"></p>
<p><input type="password" name="senha" id="senha" placeholder="Senha"></p>
<p><input type="submit" value="login" id="entrar"/></p>
<input type="hidden" name="entrar" value="login">
<p value="error" style="display:none;">por favor preencha os campos!</p>
</form>
</div>
OBS: I use this script on almost every page, and the only thing they share is the head, and none of them worked after putting the code in the external file.