how do i get textfield value then combine with regex
- by klox
i have this code for get data from textfield:
<script type="text/javascript">
var mod=document.getElementById("mod").value;
ajax(mod);
function callback() {
if(ajaxObj(mod) {
document.getElementById("divResult").innerHTML=ajaxObj.responseText;
});
};
</script>
and this one for search character:
<script>
var str="KD-R435MUN2D";
var matches=str.match(/([EJU]).*(D)/i);
if (matches) {
var firstletter = matches [1];
var secondletter = matches [2];
var thirdletter = matches [3];
alert(firstletter + secondletter + thirdletter);
}else{
alert (":(");
}
</script>
how to combine both?please help...