-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathejhtml.html
71 lines (60 loc) · 1.97 KB
/
ejhtml.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<html>
<head>
<script type="text/javascript">
document.createElement('myfield');
function myfield(args_cus_Obj)
{
if((typeof args_cus_Obj.attributes.typ !='undefined') && args_cus_Obj.attributes.typ!==null)
{
this._fieldtype=args_cus_Obj.attributes.typ.value;
}
var ev_att=args_cus_Obj.attributes.callback;
this._callbk_click=(typeof ev_att !='undefined' && ev_att!==null)?ev_att.value:null;
var t_mx_ln= parseInt(args_cus_Obj.attributes.len.value,10);
/*Segunda parte */
this.fld_txt_inp=document.createElement("input");//create an input field
this.fld_txt_inp.type= "text";
this.fld_txt_inp.className= "prueba";//define class nane through attributes
this.fld_txt_inp.style.width= "200px";//compute length
this.fld_txt_inp.naxLength = t_mx_ln; //assign max len
//3 parte by Luis
this.fld_txt_inp.onblur=function()
{
/*var _rg_zr=/^0+/;
var tmpval=(removeNumberFormat(self.fld_txt_inp.value)).replace(_rg_zr,'');
tmpval=(tmpval=='')?'0':tmpval;*/
self.fld_txt_inp.value=self.fld_txt_inp.value+"$,"; //addNumberFormat(tmpval);
};
this.fld_txt_inp.onkeypress=function(eve){
var rg=/^([0-9,\b])/;
var kn=window.event?event.keyCode : eve.which;
kc=String.fromharCode(kn);
return rg.test(kc);
};
var self=this;
args_cus_Obj.appendChild(this.fld_txt_inp);
}
//4 parte_Eduardo
function initializeUI(){
var arr= document.getElementsByTagName("*");
for(var i=0; i<arr.length;i++){
var tgNm= arr.item(i).nodeName;
var obj=null;
if(tgNm.toLowerCase()=='myfield'){
obj=new myfield(arr.item(i));
}
else if (tgNm.toLowerCase()=='myselect'){
obj=new myselect(arr.item(i));
}
}//end of for loop
}
function hi()
{
alert("hi");
}
</script>
</head>
<body onload="initializeUI()">
<myfield len="7" typ="amount" > </myfield>
</body>
</html>