Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2003, 12:55 PM
Authorized User
 
Join Date: Sep 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Greywacke
Default hehe another thing is bugging me

lo again,

another different piece of code is bugging me again... o_O
just can't seem to find the problem :/

Code:
function verify_msnm() {
    var eml = new String();
    eml = document.frm_racc.racc_msnm.value;
    eml = eml.toLowerCase;
    var x = new String();
    x = ' /\\:;?£$%^&*(){}[]~""\',#`|`¦';
    var c = new String();
    if (eml == '') {
        if (!confirm('No MSN Messenger handle! Continue?')) {
            return false;
        } else {
            return true;
        }
    }
    for (var i = 0; i < x.length; i++) {
        c = x.charAt(i);
        if (eml.indexOf(c,0) != -1) {    \\ This line is giving me uphill :/
            alert('Invalid MSN Messenger handle...\n""' + c + '"" detected...');
            return false;
        }
    }
    var atPos = eml.indexOf('@',1);
    if (atPos == -1) {
        alert("Invalid MSN user!");
        return false;
    }
    if (eml.indexOf('@',atPos+1) != -1) {
        alert('Double @ character detected!\nInvalid MSN Messenger handle...');
        return false;
    }
    var dotPos = eml.indexOf('.',atPos);
    if (dotPos <= 0 || dotPos + 3 > email.length) {
        alert('Incorrect server syntax.\nInvalid MSN Messenger handle...');
        return false;
    }
    return true;
}
once again, a swift reply would be greatly appreciated...

Sincerely,
Pierre du Toit.
__________________
Sincerely,
Pierre "Greywacke" du Toit
[email protected]
don't worry about my 0 thankyou's either way, i would say thank you should you help, and i will gladly help others when this work rush is over.
 
Old October 7th, 2003, 03:12 PM
Authorized User
 
Join Date: Sep 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Greywacke
Default

nm bout this problem, heh - it was the same fault as the last one - also email was used when calculating dotpos instead of eml :P how stupid of me? and i've been javascripting for about 7 years or so O_o

Sincerely,
Pierre du Toit.





Similar Threads
Thread Thread Starter Forum Replies Last Post
About CSS Chapter 5 the <thing> + <thing> {} part thenetduck BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 February 7th, 2007 03:45 AM
Has anyone experienced this kind of thing? jared_edge C++ Programming 1 September 18th, 2006 03:55 PM
Very important thing Kodak Javascript 6 September 10th, 2005 10:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.