One problem, similar to before, but different!

    Date: 10/26/07 (Javascript Community)    Keywords: browser, asp, java, google

    **EDIT**
    What I am asking for, is if the javascript code below is not compatible with Netscape or Firefox for some reason or if you know of any reason why it might not work in only those browsers. I can't figure out why it's not working in only those two browsers. It gives back the appropriate information in IE, Safari and Opera.

    I have attempted to search online for it but I keep hitting dead-ends. If you have suggestions as to what keywords I should be searching for online, that would also be appreciated. I have been searching for "javascript, netscape, safari, compatibility, issues, problems" and various other words like that. The code below does work in IE 6 and 7, Safari, and Opera.

    Ok, we've got a form where people put in their first name, last name, email address, and a five digit number. On the confirmation page, we want to return to them: the first initial of their first name and full last name and then the first initial of their first name, first initial of their last name, and the five digits they put in.

    For example, if I entered:
    First Name: Brittany
    Last Name: Jackson
    5 Digits: 12345

    I would want returned:
    bjackson
    bj12345

    We are using Javascript for it, and where it previously worked, it suddenly stopped working. Thanks to all of your wonderful suggestions and help, I now have it working in Internet Explorer, Opera, and Safari, but it won't work in Netscape or Firefox and I'm not sure why. I have searched and googled it, but haven't come up with an answer.

    On the form page, the javascript we have in the header is (with the script type="text/javascript" in the appropriate < >'s, of course:

    //script type="text/javascript"
    function verify(forms) {
    var errors='';
    if ((document.forms.first.value == "") || (document.forms.last.value == ""))
    errors+="Please enter your first and last name.\n";
    if (errors){
    alert(errors)
    return false;}

    fa = document.forms.first.value.charAt(0);
    la = document.forms.last.value.charAt(0)

    var len;
    var aryText = new Array()
    var hyp = "";

    if (document.forms.last.value.indexOf ('-') != -1) {
    len = document.forms.last.value.indexOf('-')
    for (var i = 0; i < len) i++; {
    aryText[i] = document.forms.last.value.charAt[i];
    hyp = hyp + aryText[i];
    }
    document.forms.username.value = fa.toLowerCase() + hyp.toLowerCase();
    }

    else if (document.forms.last.value.indexOf (' ') != -1) {
    len = document.forms.last.value.indexOf(' ')
    for (var i = 0; i < len) i++; {
    aryText[i] = document.forms.last.value.charAt[i];
    hyp = hyp + aryText[i];
    }
    document.forms.username.value = fa.toLowerCase() + hyp.toLowerCase();
    }

    else{
    document.forms.username.value = fa.toLowerCase() + document.forms.last.value.toLowerCase();
    }
    document.forms.code.value = fa.toLowerCase() + la.toLowerCase() + document.forms.ssn.value;
    return true;
    }
    //

    The words after form relate to the fields in the form.


    And then in the body, under the start of the form class we have (obviously these would have the start and end tags (<>):

    form class="forms" name="forms" action="apply.asp" method="post"

    input type="hidden" name="code"
    onchange="javascript:this.value=this.value.toLowerCase();" /
    input type="hidden" name="username"
    onchange="javascript:this.value=this.value.toLowerCase();" /

    On our confirmation page/asp page we have:

    //

Name Username* E-mail Address* Code

<% Response.Write(first)
Response.Write(" ")
Response.Write(last) %>
<% Response.Write(username) %> <% Response.Write(username) %>@oursite.org <% Response.Write(code) %>
//

It currently returns the first and last name in Netscape and Firefox, but nothing else. Again, it is working in Internet Explorer, Safari, and Opera.

Can someone see something that we're missing that is unique only for Firefox and Netscape?

Any help is truly appreciated! You guys are great! Thanks in advance!!

Source: http://community.livejournal.com/javascript/143636.html

« stuff I use for debugging || Pressing enter in a form... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home