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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Location
    UK
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Javascript problem

    I have an html page with javascript on it, but the page will not work properly. Spent a lot of time on this and can not get it right.
    Wonder if someone ca help.

  • #2
    New to the CF scene
    Join Date
    Jun 2010
    Location
    UK
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Im new to this and not sure how to proceed, sorry!

  • #3
    New to the CF scene
    Join Date
    Jun 2010
    Location
    UK
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    My son has been trying to put this code into one of my pages for my new site and is having trouble with the code (java script). I think the code needs to be edited and then the code to out put the pop-up and its contents.

    My son knows html, and jvascript is not really his thing. He has spent a lot of time and cant get it to work.

  • #4
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,743
    Thanks
    0
    Thanked 244 Times in 239 Posts
    Hi there apsomum,

    and a warm welcome to these forums.

    A link to your problematic site would enable the members to possibly assist you in your hour of need.

    coothead

  • Users who have thanked coothead for this post:

    apsomum (06-14-2010)

  • #5
    New to the CF scene
    Join Date
    Jun 2010
    Location
    UK
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by coothead View Post
    Hi there apsomum,

    and a warm welcome to these forums.

    A link to your problematic site would enable the members to possibly assist you in your hour of need.

    coothead
    Thank you for advising me of what to do..

    The page in question is http://keris-lhasa.com/keris-whelping-calculator.html

    Thank you

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,617
    Thanks
    80
    Thanked 4,635 Times in 4,597 Posts
    There are just *SO* many things I would change about that page that it's hard to start.

    But the first error seems to be that he has forms[1] and forms[0] reversed.

    The easiest way to be sure you are referring to the correct form is to *NAME* THEM!!!

    Instead of just
    <form>
    use
    <form name="dateInfo">
    and then all your code that is currently doing
    Code:
    document.forms[1].xxx
    
    should become
    
    document.dateInfo.xxx
    
    or, even better, at the top of the validation code it like this:
    
    function Validate() 
    {
    	var form = document.dateInfo;
    	if((form.month.options[1].selected==true 
    	&&  form.year.options[0].selected ==true) 
    	&& (form.day.options[29].selected ==true  
    	||  form.day.options[30].selected ==true)) {	
    	alert("Wrong date! Maximum days in February, 1996: 29");
    	return false;
    	};
    ... etc. ...
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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