Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Line 19 Char 1 - How I hate thee

    Hola everyone, first time posting but I have been trolling here for a few months.

    Here is my problem, I am a newb at programming and am at the end of my Dreamweaver class, with this in mind my sadistic teacher decided to throw Javascript at us when its not even covered in our 247 page text book, When asked about this the response was that there is enough out there on the web that we shouldn't have an issue.

    Well I have an issue, I am trying to simply run a form validation and I keep getting told by IE that:
    Line 19
    Char 1
    Error: 'undefined' is null or not an object
    code: ()

    I have ZERO idea what this means and i thought I had it down pat.

    The line itself is this:

    Code:
    var lat=str.indexOf(at)

    See next post for the entire code file, its 175 lines and I didn't want to dump it all into one huge post.

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Full code for this file

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Legend of the 5 Rings Submission</title>
    
    <script type="text/javascript">
    <!-- Hide from non-JavaScript browsers
    window.top.document.title = window.document.title;
    // Stop hiding -->
    </script>
    
    <script type="text/javascript">
    <!--Start email and form validation -->   
    function echeck(str) {
    
    var at="@"
    var dot="."
    var lat=str.indexOf(at)
    var lstr=str.length
    var ldot=str.indexOf(dot)
    if (str.indexOf(at)==-1){
    alert("Invalid E-mail Address")
    return false
    }
    
    if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
    alert("Invalid E-mail Address")
    return false
    }
    
    if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
    alert("Invalid E-mail Address")
    return false
    }
    
    if (str.indexOf(at,(lat+1))!=-1){
    alert("Invalid E-mail Address")
    return false
    }
    
    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    alert("Invalid E-mail Address")
    return false
    }
    
    if (str.indexOf(dot,(lat+2))==-1){
    alert("Invalid E-mail Address")
    return false
    }
    
    if (str.indexOf(" ")!=-1){
    alert("Invalid E-mail Address")
    return false
    }
    
    return true
    }
    
    function validateForm() { 
    with (document.form1) { 
    var alertMsg = "The following Required fields\nhave been left empty:\n"; 
    if (name.value == "") alertMsg += "\nName";  
    if (email.value == "") alertMsg += "\nE-Mail Address";
    if (yes.checked == false && no.checked == false) alertMsg += "\nNew to Game Yes/No?";
    if (echeck(email.value)==false)
    {
      email.value=""
      email.focus()
      return false
    }
    radioOption = -1; 
    for (counter=0; counter<email.length; counter++) { 
    if (years[counter].checked) radioOption = counter; 
    }
    if (radioOption == -1) alertMsg += "\nJoin our mailing lists?"; 
    if (alertMsg != "The following REQUIRED fields\nhave been left empty:\n") { 
    alert(alertMsg); 
    return false; 
    } else { 
    return true; 
    }
     }
     }
    <!--End Email and form validation-->
    </script>
    <link href="L5R.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    body {
    	background-color: #d7cea4;
    }
    -->
    </style></head>
    
    <body>
    
    <p align="center" class="Page"> If you would like to Recieve E-Mail updates of the Website or Submit your own fiction please fill out the form below: <br />
    NOTE: If submitting multiple files please compress them and submit as one *.ZIP or *.RAR file. <br />
    </p>
    <form id="form1" name="form1" method="post" action="file:///J|/Documents%20and%20Settings/bart/My%20Documents/Dreamweaver%20class/RIPOFF/confirm.php" onSubmit="return validateForm()">
      <table width="698" height="283" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="216"><div align="right" class="Page">
            <div align="left">Name: </div>
          </div></td>
          <td width="482"><input name="name" type="text" id="name" size="30" maxlength="30" tabindex="1" /></td>
        </tr>
        <tr>
          <td>Email Address : </td>
          <td><input name="email_addy" type="text" id="email" size="40" maxlength="40" tabindex="4" /></td>
        </tr>
        <tr class="Page">
          <td><div align="right" class="style6">
            <div align="left"></div>
          </div></td>
          <td>Are you new to the Game world? <br />
            <input name="yes" type="checkbox" id="yes5" value="yes" tabindex="5" />
    Yes
    <input name="no" type="checkbox" id="no5" value="no" />
    No </td>
        </tr>
        <tr class="Page">
          <td>&nbsp;</td>
          <td><span class="style6">Would you like to join the E-mailing list? <br />
              <label>
              <input type="radio" name="email" id="radio4" value="daily" tabindex="6" />
              </label>
    Daily<br />
    <label>
    <input type="radio" name="email" id="radio4" value="weekly" />
    Weekly Digest</label>
    <br />
    <label>
    <input type="radio" name="email" id="radio4" value="monthly" />
    Monthly digest </label>
    <br />
    <label>
    <input type="radio" name="email" id="radio4" value="spam" />
    I Hate Spam! </label>
          </span></td>
        </tr>
        <tr class="Page">
          <td valign="top"><div align="right" class="style6">
            <div align="left">File Submission: </div>
          </div></td>
          <td valign="top"><span class="style6">
            <select name="file" id="select3" style="vertical-align:top" tabindex="3">
              <option value="artwork_submit">Artwork</option>
              <option value="fiction_submit">Fiction</option>
              <option value="both_submit">Both</option>
            </select>
          </span></td>
        </tr>
        <tr>
          <td class="Page">File:</td>
          <td><input name="submission" type="file" size="50" maxlength="60" enctype="multipart/form-data" /></td>
        </tr>
        <tr>
          <td><div align="center">
            <input type="submit" name="Submit" value="Send Form" />
    </div></td>
          <td><input name="Reset" type="reset" id="Reset5" value="Clear Form" /></td>
        </tr>
      </table>
    </form>
    
    <!-- Form Focus -->
    <p>
      <script type="text/javascript" class="page">
    	document.form1.name.focus();
    </script>
    </p>
    </body>
    </html>

  • #3
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    Thread needs moving to JSPH forum. Moderator help needed.
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •