Advertisement
demlasjr

php - calc

May 13th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1.  
  2. <html>
  3. <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  5.     <title>Calc</title>
  6.  
  7. </head>
  8.  
  9. <script>
  10. function getXMLHTTP() { //fuction to return the xml http object
  11.         var xmlhttp=false;    
  12.         try{
  13.             xmlhttp=new XMLHttpRequest();
  14.         }
  15.         catch(e)    {        
  16.             try{            
  17.                 xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
  18.             }
  19.             catch(e){
  20.                 try{
  21.                 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  22.                 }
  23.                 catch(e1){
  24.                     xmlhttp=false;
  25.                 }
  26.             }
  27.         }
  28.              
  29.         return xmlhttp;
  30.     }
  31.    
  32.    
  33.    
  34.     function getProvincia(strURL) {        
  35.        
  36.         var req = getXMLHTTP();
  37.        
  38.         if (req) {
  39.            
  40.             req.onreadystatechange = function() {
  41.                 if (req.readyState == 4) {
  42.                     // only if "OK"
  43.                     if (req.status == 200) {                        
  44.                         document.getElementById('provinciadiv').innerHTML=req.responseText;                        
  45.                     } else {
  46.                         alert("There was a problem while using XMLHTTP:\n" + req.statusText);
  47.                     }
  48.                 }                
  49.             }            
  50.             req.open("GET", strURL, true);
  51.             req.send(null);
  52.         }
  53.                
  54.     }
  55. </script>
  56.  
  57.  
  58.  
  59.  
  60. </head>
  61.  
  62. <body onload='hideTotal()'>
  63. <div id="wrap">
  64. <form method="post" action="" name="form1">
  65. <div>
  66. <div class="cont_order">
  67. <fieldset>
  68. <label >Cantidad</label>
  69.   <tr>
  70.     <td  width="150"><div><select name="cantidad" onChange="getProvincia('findcity.php?cantidad='+this.value)">
  71.     <option value="">Selecciona cantidad</option>
  72.     <option value="1.000">1 Pallet</option>
  73.     <option value="2.000">2 Pallets</option>
  74.         </select></div></td>
  75.   </tr>
  76.   <tr>
  77.     <label>Provincia</label>
  78.     <td ><div id="provinciadiv"><select id="provincia" name="provincia">
  79.     <option>Selecciona provincia</option>
  80.         </select></div></td>
  81.   </tr>
  82.   <tr>
  83.     <td>&nbsp;</td>
  84.     <td>&nbsp;</td>
  85.   </tr>
  86.   <tr>
  87.     <td>&nbsp;</td>
  88.     <td>&nbsp;</td>
  89.   </tr>
  90. <div id="totalPrice"></div>
  91. </fieldset>
  92. </div>
  93. </form>
  94. </div></div>
  95. </body>
  96.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement