我有这个代码用于从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>
此代码用于在HTML表格和表格中显示结果:
<tr>
<td><div id="divResult"></div></td>
</tr>
这个搜索字符:
<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>
如何将两者结合起来?请帮助...
答案 0 :(得分:0)
这个答案..
<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>