Results 1 to 10 of 17
-
28th Apr 2012, 11:48 AM #1OPMemberWebsite's:
TeamUploads.com GamerW.netHelp Need In Making Assisgnment JavaScript
Hello i got assignment from my university i am not able to make it properly doing some mistakes well got this assignment
Code:Make a form in HTML document containing only one field named as Email and one Submit Button. Write your own JavaScript function to validate the email address. The Validation should be as follows: It must accept only your VU Student email address i.e; it must not accept any other student’s VU email address. It must show alert on acceptance or denial of the email address after validation. The name of the function should contain your student ID like CheckEmail_BC102034568. If you enter your wrong student email id then it must show alert as well. It must accept your student ID only at vu.edu.pk, means if you enter BC102034568@hotmail.com then it must not accept it. There must be unique alerts for each error; like if the length of the student ID is larger or smaller than the original ID then the alert should be according to that. During each alert, the entered email address must also be shown in the alert box like: “BC102034560000008@vu.edu.pk is not your Valid Email address”
Code:<html> <head> <script type="text/javascript"> function CheckMyEmail() { var x=document.forms["myForm"]["email"].value; var value=("BC102034568"); var at=x.indexOf("@"); var dot=x.lastIndexOf("vu.edu.pk"); if (at<1 || dot<at+2 || dot+2>=x.length) { alert("This is Not your valid VU e-mail address"); return false; } else { alert("This is your valid VU e-mail address"); } } </script> </head> <body> <form name="myForm" action="example.html" onsubmit="return CheckMyEmail();" method="post"> Email: <input type="text" name="email"> <input type="submit" value="Submit"> </form> </body> </html>
In this whole program
if i put BC102034568@vu.edu.pk in user input text field the alert box show me valid email and if put another email like KWWH@gmail.com, KWWH@edu.pk, the alert box must show not valid address.sahil00150 Reviewed by sahil00150 on . Help Need In Making Assisgnment JavaScript Hello i got assignment from my university i am not able to make it properly doing some mistakes well got this assignment Make a form in HTML document containing only one field named as Email and one Submit Button. Write your own JavaScript function to validate the email address. The Validation should be as follows: It must accept only your VU Student email address i.e; it must not accept any other student’s VU email address. Rating: 5
-
28th Apr 2012, 12:07 PM #2Respected MemberWebsite's:
DL4Everything.com Soft2050.inThe problem of not showing it as valid: BC102034568@vu.edu.pk is at :
PHP Code:if (at<1 || dot<at+2 || dot+2>=x.length)
PHP Code:if (at<1 || dot<at+1 || dot+2>=x.length)
-
28th Apr 2012, 12:51 PM #3OPMemberWebsite's:
TeamUploads.com GamerW.netIn this whole program
if i put BC102034568@vu.edu.pk in user input text field the alert box show me valid email and if i put another email like KWWH@gmail.com, KWWH@edu.pk, the alert box must show not valid address.
-
28th Apr 2012, 01:05 PM #4You can call me G
How about using regex for this? I'm not sure if it will be appreciated by your teacher (since you're not implementing an algorithm actually rather you're leaving the parsing job to the language..). Anyway, the following pattern should work
PHP Code:/([A-Z0-9._%+-]+)@vu.edu.pk/i
Regards,
Gaurav
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
-
28th Apr 2012, 01:07 PM #5BannedWebsite's:
pHpd.inCode:<html> <head> <script type="text/javascript"> function CheckMyEmail() { var x=document.forms["myForm"]["email"].value; var value=("BC102034568"); var at=x.indexOf("@"); var dot=x.lastIndexOf("vu.edu.pk"); if (at<1 || dot<at+1 || dot+2>=x.length) { alert("This is Not your valid VU e-mail address"); return false; } else { if(x="BC102034568@vu.edu.pk") { alert("This is your valid VU e-mail address"); } } } </script> </head> <body> <form name="myForm" action="example.html" onsubmit="return CheckMyEmail();" method="post"> Email: <input type="text" name="email"> <input type="submit" value="Submit"> </form> </body> </html>
-
28th Apr 2012, 01:13 PM #6OPMemberWebsite's:
TeamUploads.com GamerW.netThanks buddy but when i put xyz@vu.edu.pk it show me valid address. i only wanna make BC102034568@vu.edu.pk valid address all other values and email address must be show invalid.
-
28th Apr 2012, 01:15 PM #7Respected MemberWebsite's:
DL4Everything.com Soft2050.inMust be a typo, but he is using assignment operator which forcefully sets value:
Code:if(x="BC102034568@vu.edu.pk")
Code:if(x==="BC102034568@vu.edu.pk")
-
28th Apr 2012, 01:21 PM #8OPMemberWebsite's:
TeamUploads.com GamerW.netthanks i done it
Code:<html> <head> <script type="text/javascript"> function CheckMyEmail() { var x=document.forms["myForm"]["email"].value; var value=("BC102034568"); var at=x.indexOf("@"); var dot=x.lastIndexOf("vu.edu.pk"); if (at<1 || dot<at+1 || dot+2>=x.length) { alert("This is Not your valid VU e-mail address"); return false; } else { if(x=="BC102034568@vu.edu.pk") { alert("This is your valid VU e-mail address"); return false; } else { alert("not an valid email address"); return false; } } } </script> </head> <body> <form name="myForm" action="example.html" onsubmit="return CheckMyEmail();" method="post"> Email: <input type="text" name="email"> <input type="submit" value="Submit"> </form> </body> </html>
There must be unique alerts for each error; like if the length of the student ID is larger or smaller than the original ID then the alert should be according to that.
-
28th Apr 2012, 01:22 PM #9BannedWebsite's:
pHpd.inglad u got it
I used my php knowledge, becoz basically I dunno Java !
from alert(x + 'this .....') u can get the email which is entered in the box
-
28th Apr 2012, 01:24 PM #10OPMemberWebsite's:
TeamUploads.com GamerW.neti never tried reg ex
The only thing which is remain is character counting how much letter submitted in input box.
alert box must show counted characters + valid or invalid email + message
Code:<html> <head> <script type="text/javascript"> function CheckMyEmail() { var x=document.forms["myForm"]["email"].value; var value=("BC102034568"); var at=x.indexOf("@"); var dot=x.lastIndexOf("vu.edu.pk"); if (at<1 || dot<at+1 || dot+2>=x.length) { alert( x + " is Not your valid VU e-mail address"); return false; } else { if(x=="BC102034568@vu.edu.pk") { alert( x + " is your valid VU e-mail address"); return false; } else { alert( x + " is not an valid email address"); return false; } } } </script> </head> <body> <form name="myForm" action="example.html" onsubmit="return CheckMyEmail();" method="post"> Email: <input type="text" name="email"> <input type="submit" value="Submit"> </form> </body> </html>
if someone submit more then 40 characters email the alert box show email it too much large of some one enter minimum characters like 2 or 3 character alertbox must show email characters are less.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[WordPress] How to do this in javascript/php?
By thizzladen in forum Web Application/Script SupportReplies: 0Last Post: 16th Mar 2012, 12:05 AM -
Partner for making a stream / money making site.
By S?nic in forum Community CooperativeReplies: 21Last Post: 6th Jan 2012, 10:39 PM -
[Hiring] 50 $ for making Javascript addon exactly like this ( latest posts )
By TheTorrentSeller in forum Completed TransactionsReplies: 6Last Post: 1st May 2011, 05:45 PM -
Need Javascript Help
By Netguy in forum Web Development AreaReplies: 7Last Post: 19th Mar 2011, 03:24 PM -
Help About JavaScript
By macypro in forum Technical Help Desk SupportReplies: 1Last Post: 7th Dec 2010, 12:23 AM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...