www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help Please :0

  1. #1
    Join Date
    May 2012
    Posts
    8

    Help Please :0

    Alright, I been doing a code for caculating Electricty cost. The problem I am having is are they any way of adding a box to type in. I want the users to be able to type in the info and get the correct answers. Not to have to keep going in my script!

    Script is right here...

    PHP Code:
    <html>
    <
    head>
    <
    titleCOOLOLOLOL</title>
    <
    script type="text/javascript">

        var 
    wattage=2500;
        
        
        var 
    hourdaily=2;
        
        var 
    days=31;
        
        
        var 
    cost=0.07;
        
        
        var 
    item=("Dishwasher");
        
        
    //DONT DO ANYTHING ELSE...............................................................................
        










        
    var timeperday=(hourdaily*days);
        var 
    watts=1000
        
    var kilowatt=(wattage/watts);
        var 
    ans=(kilowatt*timeperday);
        var 
    ans2=(ans*cost);
        

    //title

    document.write("CACULATING HOW MUCH ELECTRICTY" "<br />");
                
    document.write("<br />");
    //given
    document.write("GIVEN" "<br/>");
                
    document.write("<br/>");
    //wattage given
    document.write("     - Wattage- " +  wattage "  W" "<br />");
                
    document.write("<br/>");
    //time per day given
    document.write("     - Time Per Day- " +  hourdaily " hours per day" "<br />");
                
    document.write("<br/>");
    //cost given
    document.write("     - Cost- " +  " $" cost " Per hour" +"<br />");
                
    document.write("<br/>");
    //days given
    document.write("     - Days- " +  days "<br/>");
                
    document.write("<br/>");
    //formula to caculate kilowatts
    document.write(wattage " watts / 1000 = " kilowatt " Kw" );
                
    document.write("<br/>");
                
    document.write("<br/>");
    //formula to caculate Total Hours
    document.write(hourdaily " Hrs x " days " days "  +   " = " timeperday " Total hours");
                
    document.write("<br/>");
                
    document.write("<br/>");
                
    document.write("<br/>");
    //Title to sloving!
    document.write("SLOVING");
                
    document.write("<br/>");
                
    document.write("<br/>");
    //Formula to caculate Total cost for a (watt) (item)
    document.write("Cost of Electricy= Kilowatt x Total hours x cost        IN THAT ORDER");
                
    document.write("<br/>");
                
    document.write("<br/>");
    //Formula to caculate Total cost for a (watt) (item)
    document.write("= " kilowatt " Kw " " x " timeperday " Total Hrs " " x " +" $ " cost);
    //Caculating Kw.h x cost
                
    document.write("<br/>");
                
    document.write("<br/>");
    document.write("= " ans " Kw.H" " x " " $ " cost);
                
    document.write("<br/>");
                
    document.write("<br/>");
                
    document.write("<br/>");
    //Answering the question
    document.write("ANSWERING");
                
    document.write("<br/>");
                
    document.write("<br/>");
    document.write("The total cost for a " +  wattage " W " item " is " "$" Math.round(ans2) + ".00" "<br />");
                
    document.write("<br/>");
                
    document.write("<br/>");

    </script>
    </head>
    <body bgcolor="yellow">
    </body>
    <html> 

  2. #2
    Join Date
    Feb 2012
    Location
    Bokaro Steel City (Jharkhand), India!
    Posts
    194
    Please learn HTML! You do not have the basics!
    ------------------------------------------------------
    DO NOT use document.write! Use innerHTML instead.
    ------------------------------------------------------
    Use <input type="text" /> or <textarea></textarea> for providing
    text box to the user!
    ------------------------------------------------------
    Learn the basics here: W3Schools
    ------------------------------------------------------
    Learn JavaScript here: JavaScript Kit
    ------------------------------------------------------
    Useful info about web developing: thesitewizard.com

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