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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with coding

    I am an absolute beginner, taking a beginner class. I am a noob for writing code. I was wondering if someone could look at my code and help me with the last 2 parts of what I need to do to accomplish my tasks. Here are the tasks and then code. If someone could please assist. I can not get a message to pop up for the cookies for someone that has already entered information. If you need me to e-mail you the notepad version, just let me know. Thank you in advance...

    1. Modify the prototype form page so that when the JavaScript function has verified that all of the required fields have been filled, a cookie is added to the user's computer. If the same user attempts to fill out the form a second time, the user will be directed to a separate HTML page advising them that they have already submitted the form.

    2. A prototype Web page that incorporates a sound file, a video file and a Java applet of a clock or a calendar. Since this will be a prototype page, do not worry about matching the formatting of the existing Web site. The sound, video and applet chosen should be appropriate for a business setting.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html lang="en" xml:lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"><!--These are the languages that are supported on the page-->

    <meta name="Author" content="David Roseberry">

    <head>

    <title>Customer Mailing List</title><!--This is the title that appears at the top of the application-->

    <LINK rel="maillist.htm" href="maillist.htm"><!--This is the file that is linked to the webpage-->

    </head>

    <body>

    <h1 style="text-align: center"><b>Kudler Fine Foods</b></h1><!--First text that appears on the page-->

    <p style="text-align: center">

    <img src="http://www.vnpremiumpackage.info/images/Kudler-food-blk.gif" alt="Help Desk"></p><BR><!--Image that appears on the page-->

    <h3 style="text-align: center">Please fill out the following information to receive special coupons and promotions.</h3>

    <script language="JavaScript" type="text/javascript">
    <!--
    function validateForm(theForm) {
    var name = theForm.name.value;
    var address = theForm.address.value;
    var email = theForm.email.value;
    if (name == "") {
    alert("Please fill in your name.");
    theForm.name.focus();
    return false;
    }
    if (address == "") {
    alert("Please fill in your address.");
    theForm.address.focus();
    return false;
    }
    if (email == "") {
    alert("Please fill in your email address.");
    theForm.email.focus();
    return false;
    }
    return true;
    }
    //-->
    <!--

    function getCookie(name) {
    var results = document.cookie.indexOf(name + "=");
    var len = sPos + name.length + 1;
    if((!sPos) && (name != document.cookie.substring(0, name.length))){
    return null;
    }
    if(name == -1){
    alert("You have already submitted your information. Thank you.");
    }
    if(address == -1){
    alert("You have already submitted your information. Thank you.");
    }
    if(email == -1){
    alert("You have already submitted your information. Thank you.");
    }

    var ePos = document.cookie.indexOf(';', len);
    if(ePos == -1) ePos = document.cookie.length;
    return unescape(document.cookie.substring(len, ePos));
    }

    function setCookie(name, value, expires, path, domain, secure){
    var today = new Date();
    if(expires){
    expires = expires * 1000 * 3600 * 24;
    }
    document.cookie = name+'='+escape(value) +
    ((expires) ? ';expires=' + new Date(today.getTime() + expires).toGMTString() : '') +
    ((path) ? ';path=' + path : '') +
    ((domain) ? ';domain=' + domain : '') +
    ((secure) ? ';secure' : '');
    }

    function deleteCookie(name, path, domain){
    if(getCookie(name)){
    setCookie(name, '', -30, path, domain);
    }
    }
    function testFunction(){
    var c = parseInt(getCookie('Value'));
    if(!c){
    alert('No initial Value\nSetting New Cookie\nValue : 0');
    setCookie('Value', 1);
    }else{
    alert('Stored Cookie\nValue : ' + c);
    alert('Setting New Cookie\nValue : ' + (c + 1));
    setCookie('Value', (c + 1));
    }
    deleteCookie('Value');
    }
    //-->
    </script>

    <form action="customerinfo.htm" method="post"
    onSubmit="return validateForm(this);"><center><!--This is the JAVAScript to ensure required fields are filled in-->

    <table>

    <TR>

    <TD>Last, First Name:*</TD>

    <TD><INPUT name="name" value="" size="20"></TD><BR><!--This is where the customer will insert their name-->

    </TR>

    <TR>

    <TD>Address:</TD>

    <TD><INPUT name="address" value="" size="20"></TD><BR><!--This is where the customer will insert their address-->

    </TR>

    <TR>

    <TD>City:</TD>

    <TD><INPUT name="City" value="" size="20"></TD><BR><!--This is where the customer will insert their city-->

    </TR>

    <TR>

    <TD>State:</TD>

    <TD><INPUT name="State" value="" size="20"></TD><BR><!--This is where the customer will insert their state-->

    <TD><small>(e.g. OH for Ohio)</small></TD>

    </TR>

    <TR>

    <TD>ZIP code:</TD>

    <TD><INPUT name="ZIP" value="" size="20"></TD><BR><!--This is where the customer will insert their state-->

    </TR>

    <TR>

    <TD>E-mail:</TD>

    <TD><INPUT name="email" value="" size="20"></TD><BR><!--This is where the customer will insert their e-mail address-->

    </TR>

    <TR>

    <TD>Phone:</TD>

    <TD><INPUT name="Phone" value="" size="20"></TD>

    <TD><small>(e.g. 555-555-5555)</small></TD></TR></table><BR></center>

    <!--This is where the customer will insert their telephone number-->

    <CENTER><INPUT type="submit" VALUE="Submit"><INPUT type="reset" VALUE="Clear"></CENTER><!--This is the submit button that take the customer to the processed page-->

    <P><CENTER><small>* = required field<BR>Address or E-mail is also required</small></CENTER></P>

    </FORM>

    </body>

    </html><!--The last 3 commands are to close open tags-->

  • #2
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    More specific request

    I was still reading the beginning posts when I first post my message. I apologize for not putting the <code> tags in my post. I also read about the homework assignments, but I just don't know why it's not working the way I have it. I figured that it was easier to just post the whole code. I am just trying to get a window popup that the infromation has already been submitted. Again, I'm totally new at this. Any help would be greatly appreciated.


  •  

    Posting Permissions

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