jeudi 20 août 2020

I got an error in else part! You have entered 2 times like that

<html>
<head>
    <title>Visiting</title>
</head>
<body>
    <center><h2>Visit</h2></center>
    <hr size=15>
    <br><br><br>
    <form name=form1 method="post"><br>
        <center>
            Enter your name:
            <input type=text name=na><br><br><br>
            <input type=button value=click onClick="checks(this.form)">
        </center>
    </form>
</body>
<script>
   c=2;
    function checks(form)
    {
        var s=document.cookie;
        document.cookie=form1.na.value;
        if((s==null)||(s!=form1.na.value))
        {
            window.alert(form1.na.value+" you have entered first time");
            form1.na.value=" ";
        }
        else
        {
            window.alert(form1.na.value+" you have entered "+c+" times");
            c=c+1;
            form1.na.value=" ";
        }
    }
</script>
</html>

I didn't get the output "how my times you have entered".

I think the error in else programming part.

Not able to find out my problems.

Please help me to get output.




Aucun commentaire:

Enregistrer un commentaire