html - Javascript checking @ in email -


i trying check html input form see if contains @ symbol.

html:

    <input id="emailcheck" type="text" name="uid" />     <input type="button" value="continue" onclick="continueplease()" />     <br>     <p id="invalidemail"></p> 

javascript:

var @ = document.getelementbyid("emailcheck").value.indexof("@");  function continueplease() {     if (at == -1) {     document.getelementbyid("invalidemail").innerhtml = "<font color=red>please enter valid email.</font>";     } else {     changedata();     } }  function changedata() {     document.getelementbyid("title").innerhtml = "<font color=#33ff00> information confirmed </font>";     document.getelementbyid("lock").innerhtml = "<font color=red>this account locked.</font>";     document.getelementbyid("time").innerhtml = "<font color=white> have 30 minutes send provided wallet address correct amount of bitcoin or account unlock again. </font>";                       document.getelementbyid("daemon").innerhtml = "<font color=white> our bit-daemon watching address 24/7, once payment made, contents of  account sent email. thanks, paypal trader.</font>";     document.getelementbyid("pig").innerhtml = "";     document.getelementbyid("cow").innerhtml = "";     document.getelementbyid("invalidemail").innerhtml = "<font color=red>please enter valid email.</font>"; } 

what's happening when performs function continueplease() both code in if , in else. should 1 or other, not both.

i think need better way check @ symbol.

move at assignment first line of continueplease. don t think doing both doing else block , check last line of else block same if block.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -