how do i get textfield value then combine with regex

Posted by klox on Stack Overflow See other posts from Stack Overflow or by klox
Published on 2010-06-09T05:34:21Z Indexed on 2010/06/09 5:42 UTC
Read the original article Hit count: 146

Filed under:
|
|

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...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about AJAX