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 04: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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.41096 seconds
  • Memory Usage 2,915KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates