hi
refer below thread
http://www.aspforums.net/Threads/830495/how-to-multiple-2-label-value-in-javascript/?s=1#Replies
ok it worked but there is other problem see here you do:
lblsum=Character Count * Number of count but I want
lblsum=Character Count * Number Of Messages
so I should change below code:
$('[id*=lblsum]').html(($("[id*=Txtmatn]").val().length) * ($('[Id*=LblTshE]')[0].innerHTML));
instead of
($("[id*=Txtmatn]").val().length
should put
$('.MessageCount').html(i);
I change code like below but it doesn't work
<script type="text/javascript">
$(function () {
var i = 0;
$('[id*=TxtSMS]').keydown(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=LblCount]').html(toPersianNumber($(this).val().length));
if ($(this).val().length % 70 == 0) {
i = $(this).val().length / 70;
i = toPersianNumber(i);
$('.MessageCount').html(i);
$('[id*=lblsum]').html(($('.MessageCount').html(i)) * ($('[Id*=LblNumberCount]')[0].innerHTML));
}
else {
i = $(this).val().length / 70;
i = toPersianNumber(parseInt(i));
$('.MessageCount').html(i);
$('[id*=lblsum]').html(($('.MessageCount').html(i)) * ($('[Id*=LblNumberCount]')[0].innerHTML));
}
}
});
$('[id*=TxtSMS]').keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=LblCount]').html(toPersianNumber($(this).val().length));
if ($(this).val().length % 70 == 0) {
i = $(this).val().length / 70;
i = toPersianNumber(i);
$('.MessageCount').html(i);
$('[id*=lblsum]').html(($('.MessageCount').html(i)) * ($('[Id*=LblNumberCount]')[0].innerHTML));
}
else {
i = $(this).val().length / 70;
i = toPersianNumber(parseInt(i));
$('.MessageCount').html(i);
$('[id*=lblsum]').html(($('.MessageCount').html(i)) * ($('[Id*=LblNumberCount]')[0].innerHTML));
}
}
});
$("[id*=TxtSMS]").bind('paste', function (e) {
setTimeout(function () {
$('[id*=LblCount]').html(toPersianNumber($("[id*=TxtSMS]").val().length));
var msgCount = $("[id*=TxtSMS]").val().length / 70;
msgCount = toPersianNumber(Math.floor(msgCount));
$('.MessageCount').html(msgCount);
$('[id*=lblsum]').html(($('.MessageCount').html(i)) * ($('[Id*=LblNumberCount]')[0].innerHTML));
}, 100);
});
});
function toPersianNumber(input) {
var inputstring = input;
var persian = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"]
for (var j = 0; j < persian.length; j++) {
inputstring = inputstring.toString().replace(new RegExp(j, "g"), persian[j]);
}
return inputstring;
}
</script>
Best regards
Neda