Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'js'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. Uncaught TypeError: Cannot set property 'onreadystatechange' of undefined at window.onload (test.js:4). The above error message is what is displayed on the console while trying to run the ajax example on page 433 of the book. What can be done to rectify it? Any clue or answer will be appreciated.
  2. Greetings everybody. I have written a code for my friend web for getting the weight; sp.gravity and wall thickness for the given Pipe diameter. All is working fine, but is there any better way to shorten the code? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Pipe weight finder</title> <script language="JavaScript">function Cal(Atext, Btext, Ctext,form){ var A = parseFloat(Atext); var B = parseFloat(Btext); var C = parseFloat(Ctext); // here, the values for A= pipe dia; B= Pressure class; c=stiffness; //the chart vlaues for K = weight/rmt; L= Specfic Gravity; M= wall thickness in mm; N= hydro test pressure in Mpa. // the switch case statement goes in matrix manner // for ine valve of A = three valves of B; and nine valves of C switch (true){ case (A == 100 && B == 3 && C == 128): K =21.4; L =100; M =1.89; N=3; break ; case (A == 100 && B == 3 && C == 256): K =21.9; L=100; M=1.92; N=3.5; break ; case (A == 100 && B == 3 && C == 512): K =22.5; L=100; M=1.95; N=3.9; break ; case (A == 100 && B == 6 && C == 128): K =31.5; L=100; M=2.02; N=4.1; break ; case (A == 100 && B == 6 && C == 256): K =32.3; L=100; M=2.16; N=4.2; break ; case (A == 100 && B == 6 && C == 512): K =32.9; L=100; M=2.69; N=4.35;break ; case (A == 100 && B == 9 && C == 128): K =42.8; L=100; M=3.15; N=4.8; break ; case (A == 100 && B == 9 && C == 256): K =43.6; L=100; M=3.45; N=4.9; break ; case (A == 100 && B == 9 && C == 512): K =44.5; L=100; M=3.78; N=5.1; break ; case (A == 150 && B == 3 && C == 128): K =65.5; L=100; M=4.86; N=6.2; break ; case (A == 150 && B == 3 && C == 256): K =68.4; L=100; M=4.95; N=6.3; break ; case (A == 150 && B == 3 && C == 512): K =69.2; L=100; M=5.01; N=6.4; break ; // ... the code goes accordingly. // the code goes up to 1000 mm (i.e A=1000; B=9; C=512) } form.Ans1.value = K + " Kg/Rmt"; form.Ans2.value = Math.round((K*100/3.28)/100) + " Kg/Ft" ; form.Ans3.value = L; form.Ans4.value = M + " mm"; form.Ans5.value = N + " Mpa"; } </script> </head> <body> <div style="text-align=center; background-color: #C0C0C0; width:225px; height:450px; border:2px double blue;"> <P><FONT SIZE="+2">Pipe weight finder</FONT><hr color="#0099FF"> </P> <form name="ratefinder" method="post"> <P>Enter Pipe dia: <select name="input_A" > <option value="100">100 mm <option value="150">150 mm <option value="200">200 mm <option value="250">250 mm <!--the option value goes up to 1000 mm --> </select></p> <P>Enter Pressure: <select name="input_B" > <option value="3"> 3 Kg <option value="6"> 6 Kg <option value="9"> 9 Kg </select></p> <P>Enter Stiffness: <select name="input_C" > <option value="128"> 128 <option value="256"> 256 <option value="512"> 512 </select></p> <P><input type="button" VALUE="SUBMIT" onClick="Cal(this.form.input_A.value, this.form.input_B.value, this.form.input_C.value, this.form)"> <input type="Reset" name="reset" value ="RESET" onClick ="(this.form);" /></P> <hr color="#0099FF"> <P>Weight: <input type=text name="Ans1" SIZE=10></P> <P>Weight /Feet: <input type=text name="Ans2" SIZE=10></P> <P>Sp.Gravity: <input type=text name="Ans3" SIZE=10></P> <P>Wall Thickness: <input type=text name="Ans4" SIZE=10></P> <P>Hydro testing: <input type=text name="Ans5" SIZE=10></P> </form> </div> </body> </html> Even though the code works fine but: Due to long JavaScript line, the page getting slower. As the JS code is Matrix manner & the value are more than 15 x 3 x3 = 135 switch cases; Kindly suggest is there any better way though PHP? Thanking you.
×
×
  • Create New...