www.webdeveloper.com
Results 1 to 3 of 3

Thread: Yep I don't know what I am doing

  1. #1
    Join Date
    Jul 2010
    Posts
    2

    Angry Yep I don't know what I am doing

    I am trying to make a rental calculator that adjusts the rent amount based on lenght of stay for my business and web site.

    I just started today. Have not touched a piece of code in my life.

    I am using a you tube video which shows me how to make a simple calculator and then I was going to build up from there.

    sadly I am stuck even on building the simple calculator.

    I cannot find out why my calculation will not work. Posting out of desperation before I abandon ship. Been at this for 3 - 4 hrs now and no luck.

    Code posting below.

    Code:
    <html>
    <head>
    <center><h1> Rental Calculator</h1></center>
    
    <script language=”JavaScript”>
    
    function writeText (form) {
    
    	var rent=form.a.value;
    	var two=form.b.value;
    
    	Form.c.value = rent*two
    
    }
    
    
    </script>
    </head>
    <body>
    <center>
    <form name="myform">
    Enter Rental Rate <br>
    <INPUT TYPE="text" Name="a" value=""><p>
    <br>
    Enter amount of time:<br>
    <INPUT TYPE="text" name="b" Value=""><p>
    <br>
    Total rental fee:<br>
    <INPUT TYPE="text" Name="c" value=""><p>
    <br>
    <INPUT TYPE="button" Name="buttonone" VALUE="display rent" 
    
    onClick="writeText(this.form) ">
    <br>
    <INPUT TYPE="button" value="Click Me" 
    
    name="button1"onclick="writeText(this.form)"> 
    
    </center>
    </body>
    </html>
    Last edited by Kor; 07-13-2010 at 04:25 AM. Reason: wrap the code [code][/code]

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Code:
    Form.c.value = rent*two
    Should be form. JavaScript is case sensitive.

    On the other hand, you have opened the <form> tag, but you have not closed it with a </form>

    Don't let empty lines inside the elements. Use type="text/javascript" instead of language=”JavaScript”; language is deprecated. Wrte all the HTML tags and attributes with lowercase. And use a Doctype.

  3. #3
    Join Date
    Jul 2010
    Posts
    2

    Thanks!

    Thanks Kor, I will make those changes and see what effect they have. I did not realize java script was case senesitive. in the demo I was following some code snippits like <HEAD> were capital and some where lower case. I know that <head> is html and I have javascript in there but I was unsure of the rules.

    I will add more if I run into issues.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles