I'm totally new on Javascript and, while doing some tests, I'm facing with this issue. The script I wrote has a button that, when clicked, should show year and IP address, but it does automatically. I saw in another 3D that this issue comes when in the "onclick" option you put a function like
<button name="bottone" onclick=myFunction()>AH-AH</button>
but this is not my case.
<button name="bottone" onclick=myFunction>AH-AH</button>
<p id="demo"></p>
<script>
function myFunction(json) {
var d = new Date();
var n = d.getFullYear();
var ip = json.ip;
document.getElementById("demo").innerHTML = n + ' ' + ip;
}
</script>
<script type="application/javascript" src="http://ift.tt/1DuqFIG"></script>
Seems like the second script "overrides" the option onClick. Any ideas? Thanks for your help!
Aucun commentaire:
Enregistrer un commentaire