www.webdeveloper.com
Results 1 to 6 of 6

Thread: no doubt abt it

  1. #1
    Join Date
    Jan 2010
    Posts
    83

    resolved no doubt abt it

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    @media print {
    input#btnPrint {
    display: none;
    }
    input#addentry{
    display: none;
    }
    
    input#deleteentry{
    display: none;
    }
    }
    </style>
    <script language="javascript">
    function changevalue(){
    var txttotal = document.getElementById('totalvalue').value;
    document.getElementById('totalvalue1').innerHTML=txttotal;
    }
    function addAll(){
    var num = document.getElementsByName('num');
    var total = 0;
    for(var k=0;k<num.length;k++)
    {
    total+=parseFloat(num[k].value);
    }
    document.f.tot.value=total;
    }
    function addAllFinal(){
    a = Number(document.f.txttotal.value);
    b = Number(document.f.txtservicetax.value);
    c = Number(document.f.txtedutax.value);
    d = Number(document.f.txthighedutax.value);
    e = Number(document.f.txtoctroi.value);
    
    f=a+b+c+d+e;
    document.f.txtgrandtotal.value = f;
    }
    
    function addRow(tableID){
    var table = document.getElementById(tableID);
    
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    
    var cell1 = row.insertCell(0);
    var element1 = document.createElement("input");
    element1.type = "checkbox";
    cell1.appendChild(element1);
    
    var cell2 = row.insertCell(1);
    cell2.innerHTML = rowCount + 1;
    
    var cell3 = row.insertCell(2);
    var element2 = document.createElement("textarea");
    element2.name = "textarea";
    element2.cols = "50";
    element2.rows = "3";
    cell3.appendChild(element2);
    
    var cell4 = row.insertCell(3);
    var element3 = document.createElement("input");
    element3.type = "text";
    element3.size = "10";
    element3.maxlength = "10";
    cell4.appendChild(element3);
    
    var cell5 = row.insertCell(4);
    var element4 = document.createElement("input");
    element4.type = "text";
    element4.size = "10";
    element4.maxlength = "10";
    cell5.appendChild(element4);
    
    var cell6 = row.insertCell(5);
    var element5 = document.createElement("input");
    element5.type = "text";
    element5.value = "00.00";
    element5.name = "num";
    element5.onblur = function(){if(isNaN(this.value)){this.value = '00.00'}};
    element5.onchange = function(){addAll()};
    element5.style = "text-align:right";
    cell6.appendChild(element5);
    }
    
    function deleteRow(tableID){
    try{
    	var table = document.getElementById(tableID);
    	var rowCount = table.rows.length;
    	
    	for(var i=0;i<rowCount;i++){
    		var row = table.rows[i];
    		var chkbox = row.cells[0].childNodes[0];
    		if(null != chkbox && true == chkbox.checked){
    			table.deleteRow(i);
    			rowCount--;
    			i--;
    		}
    		
    	}
    	}
    	catch(e){
    		alert(e);
    	}
    }	
    </script>
    <title>Tax Invoice for Numbered Series </title></head>
    <body>
    <form name="form1" method="post" action="">
    <div align="center"><font face="Georgia, Times New Roman, Times, serif"><strong><U>TAX 
      INVOICE</U></strong></font> </div>
      <p> 
        <input name="textfield7" type="text" size="30" maxlength="35" class="textfield_effect">
        <br>
        <input name="textfield6" type="text" size="40" maxlength="35" class="textfield1_effect">
        <br>
        <textarea name="address" cols="50" rows="4"></textarea>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; 
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </p>
      </form>
    <form name="f">
     Your Order No. 
      <input name="textfield2" type="text" size="50" maxlength="50">
      dated 
      <input name="textfield3" type="text" size="11" maxlength="10">
      .<br>
      <br>
      <input type="button" id="addentry" value="Add Entry" onclick="addRow('dataTable')" />
    <input type="button" id="deleteentry" value="Delete Entry" onclick="deleteRow('dataTable')" />
    <table id="dataTable" border = "1">
    <tr>
    <th></th>
    <th>Sr.No.</th>
    <th>Description</th>
    <th>quantity</th>
    <th>Rate</th>
    <th>Amount</th>
    </tr>
    <tr>
    <td><input type="checkbox" name="chk" /></td>
    <td>1</td>
          <td><textarea name="textarea" cols="50" rows="3" title="textarea1"></textarea></td>
    <td><input name="textfield" type="text" size="10" maxlength="10"></td>
    <td><input name="textfield" type="text" size="10" maxlength="10"></td>
    <td><input name="num" id="input1" value="00.00" onblur="if (!isNAN(this.value)) this.value='00.00'" onchange="addAll()" style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="Total" size="108" maxlength="9"></td>
    <td><input name="tot" value="00.00" onfocus="this.blur()" id="totalvalue" readonly style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="Sub-Total" size="108" maxlength="9" id="totalvalue1"></td>
    <td><input name="txttotal" value="00.00" id="totalvalue1" onblur="if (!isNAN(this.value)) this.value='00.00'" onchange="addAllFinal()" style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="Service Tax @" size="74" maxlength="9"></td>
    <td><input name="textfield" type="text" value="&#37;" size="5" maxlength="5"></td>
    <td><input name="textfield" value="on" onblur="if (!isNAN(this.value)) this.value='00.00'"></td>
    <td><input name="txtservicetax" value="00.00" onblur="if (!isNAN(this.value)) this.value='00.00'" onchange="addAllFinal()" style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="Edu.cess @" size="74" maxlength="9"></td>
    <td><input name="textfield" type="text" value="%" size="5" maxlength="5"></td>
    <td><input name="textfield" value="on" onblur="if (!isNAN(this.value)) this.value='00.00'"></td>
    <td><input name="txtedutax" value="00.00" onblur="if (!isNAN(this.value)) this.value='00.00'" onchange="addAllFinal()" style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="High edu.cess @" size="74" maxlength="9"></td>
    <td><input name="textfield" type="text" value="%" size="5" maxlength="5"></td>
    <td><input name="textfield" value="on" onblur="if (!isNAN(this.value)) this.value='00.00'"></td>
    <td><input name="txthighedutax" value="00.00" onblur="if (!isNAN(this.value)) this.value='00.00'" onchange="addAllFinal()" style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="OCTROI PAID (original recipt enclosed)" size="108" maxlength="9"></td>
    <td><input name="txtoctroi" value="00.00" onblur="if (!isNAN(this.value)) this.value='00.00'" onchange="addAllFinal()" style="text-align:right"></td>
    </tr>
    </table>
    <table border="1">
    <tr>
    <td><input name="textfield" type="text" value="Grand-Total" size="108" maxlength="11"></td>
    <td><input name="txtgrandtotal" value="00.00" onfocus="this.blur()" readonly style="text-align:right"></td>
    </tr>
    </table>
    <br>
    </form>
    <input type="button" id="btnPrint" onclick="window.print();" value="Print Page" />
    </body>
    </html>
    Last edited by Fang; 01-09-2010 at 03:08 AM.

  2. #2
    Join Date
    Jan 2010
    Posts
    83

    Exclamation

    just want to know some basic things:

    1: how to get value of total field in sub-total automatically.
    2: how to add values with commas and decimal places in above program.
    [i.e. values like 1,000,000.00 and 2,500.00 to be added then the thing is these values are given as input by user ]
    3: also i want to display only the content of the textbox and not the textbox
    what am i suppose to do?????

    PLEASE TELL ME I HAVE TO SUBMIT THIS IN MY OFFICE TILL MONDAY.
    PLEASE!!!!

  3. #3
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Please use BBCode when posting
    Don't use the resolved icon for you message icon; users will think the problem is solved and not look at your post.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    1. What is the difference between total field and sub-total?

    2.
    Code:
    var total = "2,500.00";
    total = total.replace(",", "");
    3.
    Code:
    textarea {border:0;}
    Why are you using an input for plain text? Users can change it and useless data is sent to the server.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  5. #5
    Join Date
    Jan 2010
    Posts
    83
    thanks fang
    there is no difference between total and subtotal i want to transfer the value of total to sub total

  6. #6
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Quote Originally Posted by saurabhkerkar View Post
    there is no difference between total and subtotal i want to transfer the value of total to sub total
    Why have 2 fields with the same value?
    At least 98% of internet users' DNA is identical to that of chimpanzees

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