Hello,
I am new to javascript. I was trying to do something rather basic. I want to creat a button that when clicked, it will increase the value of a variable by 1. And then if the variable = 1, it will write a= 1 and redirect to a url.
here’s my script, can anyone tell me where I went wrong?
<html>
<head>
<script type="text/javascript">
var a=0
function addToa() {
a=(a + 1)
if(a==1) {
document.write("a="+a)
window.location="http://"
}
</script>
</head>
<body>
<div style=" position: absolute; left:80; top: 35;">
<input type="button" onclick="addToa()" value="Next">
</div>
</body>
<html>