如何从js中删除此货币标记?

时间:2015-06-18 03:57:07

标签: javascript jquery

如何删除此“Rs”。从这个js的一部分?如果我删除html页面不提供正确的值它不能正常工作我想停止替换“卢比”。在我的HTML页面上?

function print_today() {
  // ***********************************************
  // AUTHOR: WWW.CGISCRIPT.NET, LLC
  // URL: http://www.cgiscript.net
  // Use the script, just leave this message intact.
  // Download your FREE CGI/Perl Scripts today!
  // ( http://www.cgiscript.net/scripts.htm )
  // ***********************************************
  var now = new Date();
  var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
  var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
  function fourdigits(number) {
    return (number < 1000) ? number + 1900 : number;
  }
  var today =  months[now.getMonth()] + " " + date + ", " + (fourdigits(now.getYear()));
  return today;
}

// from http://www.mediacollege.com/internet/javascript/number/round.html
function roundNumber(number,decimals) {
  var newString;// The new rounded number
  decimals = Number(decimals);
  if (decimals < 1) {
    newString = (Math.round(number)).toString();
  } else {
    var numString = number.toString();
    if (numString.lastIndexOf(".") == -1) {// If there is no decimal point
      numString += ".";// give it one at the end
    }
    var cutoff = numString.lastIndexOf(".") + decimals;// The point at which to truncate the number
    var d1 = Number(numString.substring(cutoff,cutoff+1));// The value of the last decimal place that we'll end up with
    var d2 = Number(numString.substring(cutoff+1,cutoff+2));// The next decimal, after the last one we want
    if (d2 >= 5) {// Do we need to round up at all? If not, the string will just be truncated
      if (d1 == 9 && cutoff > 0) {// If the last digit is 9, find a new cutoff point
        while (cutoff > 0 && (d1 == 9 || isNaN(d1))) {
          if (d1 != ".") {
            cutoff -= 1;
            d1 = Number(numString.substring(cutoff,cutoff+1));
          } else {
            cutoff -= 1;
          }
        }
      }
      d1 += 1;
    } 
    if (d1 == 10) {
      numString = numString.substring(0, numString.lastIndexOf("."));
      var roundedNum = Number(numString) + 1;
      newString = roundedNum.toString() + '.';
    } else {
      newString = numString.substring(0,cutoff) + d1.toString();
    }
  }
  if (newString.lastIndexOf(".") == -1) {// Do this again, to the new string
    newString += ".";
  }
  var decs = (newString.substring(newString.lastIndexOf(".")+1)).length;
  for(var i=0;i<decimals-decs;i++) newString += "0";
  //var newNumber = Number(newString);// make it a number if you like
  return newString; // Output the result to the form field (change for your purposes)
}

function update_total() {
  var total = 0;
  $('.price').each(function(i){
    price = $(this).html().replace("Rs.","");
    if (!isNaN(price)) total += Number(price);
  });

  total = roundNumber(total,2);

  $('#subtotal').html("Rs."+total);
  $('#total').html("Rs."+total);
  
  update_balance();
}

function update_balance() {

  var due = $("#total").html().replace("Rs.","") - $("#paid").val().replace("Rs.","");
  due = roundNumber(due,2);
  
  $('.due').html("Rs."+due);
}

function update_price() {
  var row = $(this).parents('.item-row');
  var price = row.find('.cost').val().replace("Rs.","") * row.find('.qty').val();
  price = roundNumber(price,2);
  isNaN(price) ? row.find('.price').html("N/A") : row.find('.price').html("Rs."+price);
  
  update_total();
}

function bind() {
  $(".cost").blur(update_price);
  $(".qty").blur(update_price);
}

$(document).ready(function() {

  $('input').click(function(){
    $(this).select();
  });

  $("#paid").blur(update_balance);
   
  $("#addrow").click(function(){
    $(".item-row:last").after('<tr class="item-row"><td class="item-name"><div class="delete-wpr"><textarea>Item Name</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td><td class="description"><textarea>Description</textarea></td><td><textarea class="cost">Rs.0</textarea></td><td><textarea class="qty">0</textarea></td><td><span class="price">Rs.0</span></td></tr>');
    if ($(".delete").length > 0) $(".delete").show();
    bind();
  });
  
  bind();
  
  $(".delete").live('click',function(){
    $(this).parents('.item-row').remove();
    update_total();
    if ($(".delete").length < 2) $(".delete").hide();
  });
  
  $("#cancel-logo").click(function(){
    $("#logo").removeClass('edit');
  });
  $("#delete-logo").click(function(){
    $("#logo").remove();
  });
  $("#change-logo").click(function(){
    $("#logo").addClass('edit');
    $("#imageloc").val($("#image").attr('src'));
    $("#image").select();
  });
  $("#save-logo").click(function(){
    $("#image").attr('src',$("#imageloc").val());
    $("#logo").removeClass('edit');
  });
  
  $("#date").val(print_today());
  
});
/*
	 CSS-Tricks Example
	 by Chris Coyier
	 http://css-tricks.com
*/

* { margin: 0; padding: 0; }
body { font: 14px/1.4 Georgia, serif; }
#page-wrap { width: 800px; margin: 0 auto; }

textarea { border: 0; font: 14px Georgia, Serif; overflow: hidden; resize: none; }
table { border-collapse: collapse; }
table td, table th { border: 1px solid black; padding: 5px; }

#no_bodear_tbl{
border: 0px solid black; padding: 6px;
}
#header { height: 15px; width: 100%; margin: 20px 0; background: #222; text-align: center; color: white; font: bold 15px Helvetica, Sans-Serif; text-decoration: uppercase; letter-spacing: 20px; padding: 8px 0px; }

#address { width: 250px; height: 150px; float: left; }
#customer { overflow: hidden; }

#logo { text-align: right; float: right; position: relative; margin-top: 25px; border: 1px solid #fff; max-width: 540px; max-height: 100px; overflow: hidden; }
#logo:hover, #logo.edit { border: 1px solid #000; margin-top: 0px; max-height: 125px; }
#logoctr { display: none; }
#logo:hover #logoctr, #logo.edit #logoctr { display: block; text-align: right; line-height: 25px; background: #eee; padding: 0 5px; }
#logohelp { text-align: left; display: none; font-style: italic; padding: 10px 5px;}
#logohelp input { margin-bottom: 5px; }
.edit #logohelp { display: block; }
.edit #save-logo, .edit #cancel-logo { display: inline; }
.edit #image, #save-logo, #cancel-logo, .edit #change-logo, .edit #delete-logo { display: none; }
#customer-title { font-size: 20px; font-weight: bold; float: left; }

#meta { margin-top: 1px; width: 300px; float: right; }
#meta td { text-align: right;  }
#meta td.meta-head { text-align: left; background: #eee; }
#meta td textarea { width: 100%; height: 20px; text-align: right; }

#items { clear: both; width: 100%; margin: 30px 0 0 0; border: 1px solid black; }
#items th { background: #eee; }
#items textarea { width: 80px; height: 50px; }
#items tr.item-row td { border: 0; vertical-align: top; }
#items td.description { width: 300px; }
#items td.item-name { width: 175px; }
#items td.description textarea, #items td.item-name textarea { width: 100%; }
#items td.total-line { border-right: 0; text-align: right; }
#items td.total-value { border-left: 0; padding: 10px; }
#items td.total-value textarea { height: 20px; background: none; }
#items td.balance { background: #eee; }
#items td.blank { border: 0; }

#terms { text-align: center; margin: 20px 0 0 0; }
#terms h5 { text-transform: uppercase; font: 13px Helvetica, Sans-Serif; letter-spacing: 10px; border-bottom: 1px solid black; padding: 0 0 8px 0; margin: 0 0 8px 0; }
#terms textarea { width: 100%; text-align: center;}

textarea:hover, textarea:focus, #items td.total-value textarea:hover, #items td.total-value textarea:focus, .delete:hover { background-color:#EEFF88; }

.delete-wpr { position: relative; }
.delete { display: block; color: #000; text-decoration: none; position: absolute; background: #EEEEEE; font-weight: bold; padding: 0px 3px; border: 1px solid; top: -6px; left: -22px; font-family: Verdana; font-size: 12px; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />

	<title>infintiaLK Billing</title>
	
	<link rel='stylesheet' type='text/css' href='css/style_bill.css' />
	<link rel='stylesheet' type='text/css' href='css/print_bill.css' media="print" />
	<script type='text/javascript' src='js/jquery-1.3.2.min_bill.js'></script>
	<script type='text/javascript' src='js/example_bill.js'></script>

	<style type="text/css" media="print">
.dontprint
{ display: none; }
</style>
</head>

<body>
<?php
function wlcmMsg() {
    echo "Welcome ! ".$name=$_SESSION['adminlog']; 
}
session_start(); 
		if(!isset($_SESSION['adminlog'])){
		 
		}

else if(isset($_SESSION['adminlog'])){

echo '<table align="right" border="0" class="dontprint">
<tr  width="50%"><td>Hi! '.$name=$_SESSION['adminlog']; echo '</td>
<td><form  align="right" action="menu.php"><input type="submit" value="Back" /></form></td>
<td><form  align="right" action="logout.php"><input type="submit" value="logout" id="search"/></form></td>
</tr></table>';


}


//connecting to the database 
define('DB_HOST', 'localhost'); 
define('DB_NAME', 'infinitiabill'); 
define('DB_USER','root'); 
define('DB_PASSWORD',''); 

$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); 
$db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); 
//inserting Record to the database 


$result = mysql_query('SELECT InvoiceNo FROM billdata ORDER BY InvoiceNo DESC LIMIT 1;');
if (mysql_num_rows($result) > 0) {
   $max_InvoiceNo = mysql_fetch_row($result);
  
   //echo $max_InvoiceNo[0]; //Here it is
}

	mysql_close($con); 

		?>
	<script>
function myFunction() {
    window.print();
}
</script>	
		

	<div id="page-wrap">
	<form action="save_process.php" name="invicedata" method="post">
		<textarea id="header">INVOICE</textarea>
		
		<div id="identity">
		
            <textarea id="address">infintiaLK
No.210,Temple Road,
Ulukade Junction, Ganemulla,
Sri Lanka 11020.
(+94)76 75 57 909 / (+94)71 95 57 909
infinitialk@gmail.com
</textarea>

            <div id="logo">

              <div id="logoctr">
                <!--<a href="javascript:;" id="change-logo" title="Change logo">Change Logo</a>-->
                <a href="javascript:;" id="save-logo" title="Save changes">Save |</a>
                
                <!--<a href="javascript:;" id="delete-logo" title="Delete logo">Delete Logo</a>-->
                <a href="javascript:;" id="cancel-logo" title="Cancel changes">Cancel</a>
              </div>

              <div id="logohelp">
                <input id="imageloc" type="text" size="50" value="" /><br />
                (max width: 540px, max height: 100px)
              </div>
              <img id="image" src="images/logo1_bill.png" alt="logo" />
            </div>
		
		</div>
		
		<div style="clear:both"></div>
		
		<div id="customer">

            <textarea name="CmpnyName" id="customer-title">Company Name</textarea>

            <table id="meta">
                <tr name="invno">
                    <td class="meta-head">Invoice #</td>
                    <td ><?php echo $max_InvoiceNo[0]+1; ?></td>
                </tr>
                <tr>

                    <td class="meta-head">Date</td>
                    <td><textarea name="issedate" id="date"></textarea></td>
                </tr>
				 <tr>

                    <td class="meta-head">Created by</td>
                    <td><?php echo $name=$_SESSION['adminlog']; ?></div></td>
                </tr>
                <tr>
                    <td class="meta-head">Amount Due Rs.</td>
                    <td><textarea class="due" name="due" readonly>0.00</textarea></td>
                </tr>

            </table>
		
		</div>
		
		<table id="items">
		
		  <tr>
		      <th>Item</th>
		      <th>Description</th>
		      <th>Unit Cost</th>
		      <th>Quantity</th>
		      <th>Price</th>
		  </tr>
		  
		  <tr class="item-row">
		      <td  class="item-name"><div class="delete-wpr"><textarea name="itemname">Web Updates</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>
		      <td class="description"><textarea name="item_details">Monthly web updates for http://widgetcorp.com (Nov. 1 - Nov. 30, 2009)</textarea></td>
		      <td><textarea class="cost">Rs.650.00</textarea></td>
		      <td><textarea class="qty">1</textarea></td>
		      <td>Rs.<span class="price">650.00</span></td>
		  </tr>
		  
		  <tr  class="item-row">
		      <td name="item_details" class="item-name"><div class="delete-wpr"><textarea  name="itemname">SSL Renewals</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>

		      <td class="description"><textarea name="item_details">Yearly renewals of SSL certificates on main domain and several subdomains</textarea></td>
		      <td><textarea class="cost">Rs.75.00</textarea></td>
		      <td><textarea class="qty">3</textarea></td>
		      <td>Rs.<span class="price">225.00</span></td>
		  </tr>
		  
		  <tr id="hiderow">
		    <td colspan="5"><a id="addrow" href="javascript:;" title="Add a row">Add a item</a></td>
		  </tr>
		  
		  <tr>
		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line">Subtotal Rs.</td>
		      <td class="total-value" >875.00</td>
		  </tr>
		  <tr>

		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line">Total Rs.</td>
		      <td class="total-value"><textarea id="total" name="total" readonly>875.00</textarea></td>
		  </tr>
		  <tr>
		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line">Amount Paid Rs.</td>

		      <td class="total-value"><textarea name="paid" id="paid">0.00</textarea></td>
		  </tr>
		  <tr>
		      <td colspan="2" class="blank"> </td>
		      <td colspan="2" class="total-line balance">Balance Due Rs.</td>
		      <td class="total-value balance"><div  class="due">0.00</div></td>
		  </tr>
		
		</table>
		
		<div id="terms">
		  <h5>Terms</h5>
		 NET 30 Days. Finance Charge of 1.5% will be made on unpaid balances after 30 days.
		  Make all checks payable to infinitiaLK.<br> THANK YOU FOR YOUR BUSINESS!
			
		</div>
		<div class="dontprint"><br>
		<center><table name="no_bodear_tbl">
		<tr><td>
		<form action="save_process.php"> 
		<input type="submit" value="Save" ></form></td>
		<td></td>
		<td><form action="http://pdfcrowd.com/url_to_pdf/">
		<input type="submit" value="Save to a PDF">
		</form></td>
		</tr></table></center>
		</div>
		
		<!--<button onclick="myFunction()">Print Bill</button>-->
	</form>
	

 <footer><br/>
<center> Copyright &copy; 2012 - 2015 infinitiaLK Inc.
</footer><br/>
</body> 

</html>

这里也添加了html和css代码

3 个答案:

答案 0 :(得分:2)

尝试改为 split

例如:

function update_balance() {
    var total= parseInt($("#total").html().split("Rs.")[1]);
    var pval=parseInt($("#paid").val().split("Rs.")[1]);
    var due = total-pval;
    due = roundNumber(due,2);
    $('.due').html("Rs."+due);
}

update_price()

相同

答案 1 :(得分:0)

已编辑,@ Sampath M Jay,我只是更改了您在代码段上发布的一些代码,以使其正常运行。需要知道的事情:

  1. 您是否看到代码片段需要jQuery?我认为这可能是你的代码片段不起作用的原因,无论如何,我选择了jQuery 1.11.0,这使.live弃用了,所以我将$(".delete").live(...更改为$(".delete").on(...,它只是做了同样的事情。

  2. 您的代码段的PHP部分已被删除,因为堆叠代码段不会尝试解析它,因此我认为是否删除它只是一个小问题。

  3. 某些html部分也有Rs.前缀,因此请将其删除。

  4. 在js部分中,update_totalupdate_balanceupdate_price和domready代码的某些部分

    $("#addrow").click(function() {
        $(".item-row:last").after('<tr class="item-row"><td class="item-name"><div...
        bind();
    ...})
    

    所有这些都与Rs.有关系,因此将其删除。

  5. 左边是'应该没问题'版本,没有烦恼Rs.,享受,并随时询问是否有任何问题。

  6. function print_today() {
      // ***********************************************
      // AUTHOR: WWW.CGISCRIPT.NET, LLC
      // URL: http://www.cgiscript.net
      // Use the script, just leave this message intact.
      // Download your FREE CGI/Perl Scripts today!
      // ( http://www.cgiscript.net/scripts.htm )
      // ***********************************************
      var now = new Date();
      var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
      var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
      function fourdigits(number) {
        return (number < 1000) ? number + 1900 : number;
      }
      var today =  months[now.getMonth()] + " " + date + ", " + (fourdigits(now.getYear()));
      return today;
    }
    
    // from http://www.mediacollege.com/internet/javascript/number/round.html
    function roundNumber(number,decimals) {
      var newString;// The new rounded number
      decimals = Number(decimals);
      if (decimals < 1) {
        newString = (Math.round(number)).toString();
      } else {
        var numString = number.toString();
        if (numString.lastIndexOf(".") == -1) {// If there is no decimal point
          numString += ".";// give it one at the end
        }
        var cutoff = numString.lastIndexOf(".") + decimals;// The point at which to truncate the number
        var d1 = Number(numString.substring(cutoff,cutoff+1));// The value of the last decimal place that we'll end up with
        var d2 = Number(numString.substring(cutoff+1,cutoff+2));// The next decimal, after the last one we want
        if (d2 >= 5) {// Do we need to round up at all? If not, the string will just be truncated
          if (d1 == 9 && cutoff > 0) {// If the last digit is 9, find a new cutoff point
            while (cutoff > 0 && (d1 == 9 || isNaN(d1))) {
              if (d1 != ".") {
                cutoff -= 1;
                d1 = Number(numString.substring(cutoff,cutoff+1));
              } else {
                cutoff -= 1;
              }
            }
          }
          d1 += 1;
        } 
        if (d1 == 10) {
          numString = numString.substring(0, numString.lastIndexOf("."));
          var roundedNum = Number(numString) + 1;
          newString = roundedNum.toString() + '.';
        } else {
          newString = numString.substring(0,cutoff) + d1.toString();
        }
      }
      if (newString.lastIndexOf(".") == -1) {// Do this again, to the new string
        newString += ".";
      }
      var decs = (newString.substring(newString.lastIndexOf(".")+1)).length;
      for(var i=0;i<decimals-decs;i++) newString += "0";
      //var newNumber = Number(newString);// make it a number if you like
      return newString; // Output the result to the form field (change for your purposes)
    }
    
    function update_total() {
      var total = 0;
      $('.price').each(function(i){
        price = parseInt($(this).html());
        if (!isNaN(price)) total += Number(price);
      });
    
      total = roundNumber(total,2);
    
      $('#subtotal').html(total);
      $('#total').html(total);
      
      update_balance();
    }
    
    function update_balance() {
    
      var due = parseInt($("#total").html(), 10) - $("#paid").val();
      due = roundNumber(due,2);
      
      $('.due').html(due);
    }
    
    function update_price() {
      var row = $(this).parents('.item-row');
      var price = row.find('.cost').val() * row.find('.qty').val();
      price = roundNumber(price,2);
      isNaN(price) ? row.find('.price').html("N/A") : row.find('.price').html(price);
      
      update_total();
    }
    
    function bind() {
      $(".cost").blur(update_price);
      $(".qty").blur(update_price);
    }
    
    $(document).ready(function() {
    
      $('input').click(function(){
        $(this).select();
      });
    
      $("#paid").blur(update_balance);
       
      $("#addrow").click(function(){
        $(".item-row:last").after('<tr class="item-row"><td class="item-name"><div class="delete-wpr"><textarea>Item Name</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td><td class="description"><textarea>Description</textarea></td><td><textarea class="cost">0</textarea></td><td><textarea class="qty">0</textarea></td><td><span class="price">0</span></td></tr>');
        if ($(".delete").length > 0) $(".delete").show();
        bind();
      });
      
      bind();
      
      $(".delete").on('click',function(){
        $(this).parents('.item-row').remove();
        update_total();
        if ($(".delete").length < 2) $(".delete").hide();
      });
    
      $("#cancel-logo").click(function(){
        $("#logo").removeClass('edit');
      });
      $("#delete-logo").click(function(){
        $("#logo").remove();
      });
      $("#change-logo").click(function(){
        $("#logo").addClass('edit');
        $("#imageloc").val($("#image").attr('src'));
        $("#image").select();
      });
      $("#save-logo").click(function(){
        $("#image").attr('src',$("#imageloc").val());
        $("#logo").removeClass('edit');
      });
      
      $("#date").val(print_today());
      
    });
    /*
    	 CSS-Tricks Example
    	 by Chris Coyier
    	 http://css-tricks.com
    */
    
    * { margin: 0; padding: 0; }
    body { font: 14px/1.4 Georgia, serif; }
    #page-wrap { width: 800px; margin: 0 auto; }
    
    textarea { border: 0; font: 14px Georgia, Serif; overflow: hidden; resize: none; }
    table { border-collapse: collapse; }
    table td, table th { border: 1px solid black; padding: 5px; }
    
    #no_bodear_tbl{
    border: 0px solid black; padding: 6px;
    }
    #header { height: 15px; width: 100%; margin: 20px 0; background: #222; text-align: center; color: white; font: bold 15px Helvetica, Sans-Serif; text-decoration: uppercase; letter-spacing: 20px; padding: 8px 0px; }
    
    #address { width: 250px; height: 150px; float: left; }
    #customer { overflow: hidden; }
    
    #logo { text-align: right; float: right; position: relative; margin-top: 25px; border: 1px solid #fff; max-width: 540px; max-height: 100px; overflow: hidden; }
    #logo:hover, #logo.edit { border: 1px solid #000; margin-top: 0px; max-height: 125px; }
    #logoctr { display: none; }
    #logo:hover #logoctr, #logo.edit #logoctr { display: block; text-align: right; line-height: 25px; background: #eee; padding: 0 5px; }
    #logohelp { text-align: left; display: none; font-style: italic; padding: 10px 5px;}
    #logohelp input { margin-bottom: 5px; }
    .edit #logohelp { display: block; }
    .edit #save-logo, .edit #cancel-logo { display: inline; }
    .edit #image, #save-logo, #cancel-logo, .edit #change-logo, .edit #delete-logo { display: none; }
    #customer-title { font-size: 20px; font-weight: bold; float: left; }
    
    #meta { margin-top: 1px; width: 300px; float: right; }
    #meta td { text-align: right;  }
    #meta td.meta-head { text-align: left; background: #eee; }
    #meta td textarea { width: 100%; height: 20px; text-align: right; }
    
    #items { clear: both; width: 100%; margin: 30px 0 0 0; border: 1px solid black; }
    #items th { background: #eee; }
    #items textarea { width: 80px; height: 50px; }
    #items tr.item-row td { border: 0; vertical-align: top; }
    #items td.description { width: 300px; }
    #items td.item-name { width: 175px; }
    #items td.description textarea, #items td.item-name textarea { width: 100%; }
    #items td.total-line { border-right: 0; text-align: right; }
    #items td.total-value { border-left: 0; padding: 10px; }
    #items td.total-value textarea { height: 20px; background: none; }
    #items td.balance { background: #eee; }
    #items td.blank { border: 0; }
    
    #terms { text-align: center; margin: 20px 0 0 0; }
    #terms h5 { text-transform: uppercase; font: 13px Helvetica, Sans-Serif; letter-spacing: 10px; border-bottom: 1px solid black; padding: 0 0 8px 0; margin: 0 0 8px 0; }
    #terms textarea { width: 100%; text-align: center;}
    
    textarea:hover, textarea:focus, #items td.total-value textarea:hover, #items td.total-value textarea:focus, .delete:hover { background-color:#EEFF88; }
    
    .delete-wpr { position: relative; }
    .delete { display: block; color: #000; text-decoration: none; position: absolute; background: #EEEEEE; font-weight: bold; padding: 0px 3px; border: 1px solid; top: -6px; left: -22px; font-family: Verdana; font-size: 12px; }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
      <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
    
      <title>infintiaLK Billing</title>
      
      <link rel='stylesheet' type='text/css' href='css/style_bill.css' />
      <link rel='stylesheet' type='text/css' href='css/print_bill.css' media="print" />
      <script type='text/javascript' src='js/jquery-1.3.2.min_bill.js'></script>
      <script type='text/javascript' src='js/example_bill.js'></script>
    
      <style type="text/css" media="print">
    .dontprint
    { display: none; }
    </style>
    </head>
    
    <body>
    
      <script>
    function myFunction() {
        window.print();
    }
    </script> 
        
    
      <div id="page-wrap">
      <form action="save_process.php" name="invicedata" method="post">
        <textarea id="header">INVOICE</textarea>
        
        <div id="identity">
        
                <textarea id="address">infintiaLK
    No.210,Temple Road,
    Ulukade Junction, Ganemulla,
    Sri Lanka 11020.
    (+94)76 75 57 909 / (+94)71 95 57 909
    infinitialk@gmail.com
    </textarea>
    
                <div id="logo">
    
                  <div id="logoctr">
                    <!--<a href="javascript:;" id="change-logo" title="Change logo">Change Logo</a>-->
                    <a href="javascript:;" id="save-logo" title="Save changes">Save |</a>
                    
                    <!--<a href="javascript:;" id="delete-logo" title="Delete logo">Delete Logo</a>-->
                    <a href="javascript:;" id="cancel-logo" title="Cancel changes">Cancel</a>
                  </div>
    
                  <div id="logohelp">
                    <input id="imageloc" type="text" size="50" value="" /><br />
                    (max width: 540px, max height: 100px)
                  </div>
                  <img id="image" src="images/logo1_bill.png" alt="logo" />
                </div>
        
        </div>
        
        <div style="clear:both"></div>
        
        <div id="customer">
    
                <textarea name="CmpnyName" id="customer-title">Company Name</textarea>
    
                <table id="meta">
                    <tr name="invno">
                        <td class="meta-head">Invoice #</td>
                        <td ><?php echo $max_InvoiceNo[0]+1; ?></td>
                    </tr>
                    <tr>
    
                        <td class="meta-head">Date</td>
                        <td><textarea name="issedate" id="date"></textarea></td>
                    </tr>
             <tr>
    
                        <td class="meta-head">Created by</td>
                        <td><?php echo $name=$_SESSION['adminlog']; ?></div></td>
                    </tr>
                    <tr>
                        <td class="meta-head">Amount Due </td>
                        <td><textarea class="due" name="due" readonly>0.00</textarea></td>
                    </tr>
    
                </table>
        
        </div>
        
        <table id="items">
        
          <tr>
              <th>Item</th>
              <th>Description</th>
              <th>Unit Cost</th>
              <th>Quantity</th>
              <th>Price</th>
          </tr>
          
          <tr class="item-row">
              <td  class="item-name"><div class="delete-wpr"><textarea name="itemname">Web Updates</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>
              <td class="description"><textarea name="item_details">Monthly web updates for http://widgetcorp.com (Nov. 1 - Nov. 30, 2009)</textarea></td>
              <td><textarea class="cost">650.00</textarea></td>
              <td><textarea class="qty">1</textarea></td>
              <td><span class="price">650.00</span></td>
          </tr>
          
          <tr  class="item-row">
              <td name="item_details" class="item-name"><div class="delete-wpr"><textarea  name="itemname">SSL Renewals</textarea><a class="delete" href="javascript:;" title="Remove row">X</a></div></td>
    
              <td class="description"><textarea name="item_details">Yearly renewals of SSL certificates on main domain and several subdomains</textarea></td>
              <td><textarea class="cost">75.00</textarea></td>
              <td><textarea class="qty">3</textarea></td>
              <td><span class="price">225.00</span></td>
          </tr>
          
          <tr id="hiderow">
            <td colspan="5"><a id="addrow" href="javascript:;" title="Add a row">Add a item</a></td>
          </tr>
          
          <tr>
              <td colspan="2" class="blank"> </td>
              <td colspan="2" class="total-line">Subtotal</td>
              <td class="total-value" >875.00</td>
          </tr>
          <tr>
    
              <td colspan="2" class="blank"> </td>
              <td colspan="2" class="total-line">Total</td>
              <td class="total-value"><textarea id="total" name="total" readonly>875.00</textarea></td>
          </tr>
          <tr>
              <td colspan="2" class="blank"> </td>
              <td colspan="2" class="total-line">Amount Paid</td>
    
              <td class="total-value"><textarea name="paid" id="paid">0.00</textarea></td>
          </tr>
          <tr>
              <td colspan="2" class="blank"> </td>
              <td colspan="2" class="total-line balance">Balance Due</td>
              <td class="total-value balance"><div  class="due">0.00</div></td>
          </tr>
        
        </table>
        
        <div id="terms">
          <h5>Terms</h5>
         NET 30 Days. Finance Charge of 1.5% will be made on unpaid balances after 30 days.
          Make all checks payable to infinitiaLK.<br> THANK YOU FOR YOUR BUSINESS!
          
        </div>
        <div class="dontprint"><br>
        <center><table name="no_bodear_tbl">
        <tr><td>
        <form action="save_process.php"> 
        <input type="submit" value="Save" ></form></td>
        <td></td>
        <td><form action="http://pdfcrowd.com/url_to_pdf/">
        <input type="submit" value="Save to a PDF">
        </form></td>
        </tr></table></center>
        </div>
        
        <!--<button onclick="myFunction()">Print Bill</button>-->
      </form>
      
    
     <footer><br/>
    <center> Copyright &copy; 2012 - 2015 infinitiaLK Inc.
    </footer><br/>
    </body> 
    
    </html>

答案 2 :(得分:0)

您应该删除在下面提到的位置添加的“Rs”字符串。然后,您可以删除所有replace("Rs.","")

function update_total() {
   ...
   $('#subtotal').html("Rs."+total);
   $('#total').html("Rs."+total);
   ...
}

function update_balance() {
   ...
   $('.due').html("Rs."+due);
   ...
}

function update_price() {
   ...
   row.find('.price').html("Rs."+price);
   ...
}