tags:

views:

66

answers:

1

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>

this code for show result inside HTML table and the table like:

<tr>
<td><div id="divResult"></div></td>
</tr>

and this one for search character:

<script>
var str="KD-R435MUN2D";
var matches=str.match(/(EE|[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...

A: 

this the answer..

<script type="text/javascript">
$("#mod").val();
var matches=str.match(/(EE|[EJU]).*(D)/i);
if (matches) {
     var firstletter = matches [1];
     var secondletter = matches [2];
     var thirdletter = matches [3];
alert(firstletter + secondletter + thirdletter);
}else{
      alert (":(");
}
</script>
klox