**** Html
<input type="text" value="'.$money.'" name="tk_tien" class="form-control" id="fname" onkeyup="xxxFunction()">
<span id="demo"></span>
**** Script
function xxxFunction() {
var x = document.getElementById("fname").value;
var nf = new Intl.NumberFormat();
var number = nf.format(x);
document.getElementById("demo").innerHTML = number;
}
2.
**** HTML
<table id="table1">
<select name="protocol"></select>
<input name="dep_adv1">
<input name="dep_adv2">
<input name="show_link">
</table>
<div class="adsshowtitle">
<a href=""></a>
</div>
**** SCRIPT
$(document).ready(function() {
capnhat_box();
$("#table1 input").keyup(function(event) {
capnhat_box();
});
$("#table1 select").change(function(event) {
capnhat_box();
});
});
function capnhat_box(){
$(".adsshowtitle a").html($("input[name='titleadwords']").val());
$(".adsshowtitle a").attr("href", $("select[name='protocol']").val() +$("input[name='destUrl']").val());
$(".adsshowdes1").html($("input[name='dep_adv1']").val());
$(".adsshowdes2").html($("input[name='dep_adv2']").val());
$(".adsshowlink").html($("input[name='show_link']").val());
}
3.
**** HTML
<input type="text" name="firstname" onkeyup="myFirstname()" id="myfirstname">
<div id="ajaxfirstname"></div>
**** SCRIPT
function myFirstname() {
var x = document.getElementById("myfirstname").value;
if(x==""){
document.getElementById("ajaxfirstname").innerHTML = "Jane Doe";
}else{
document.getElementById("ajaxfirstname").innerHTML = x;
}
}
