如何将用户选择限制为三个选项? [英] how do i limit user choice to three options?

查看:87
本文介绍了如何将用户选择限制为三个选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个允许1到100条目的字段,或者值r。或者值i或者值na


我的脚本看起来像这样,但它继续允许i的重复条目。和r当

" i"在change *事件中输入。缺少什么?


if(xfa.event.change!=""&&!xfa.event.newText.match(/ ^ [0-9] + (\ + | - )?$ | ^(na?)?$ | ^(r)?$ | ^(i)/)){

xfa.event.change ="" ;;

xfa.host.beep(" 3");

}

I have a field that allows entries of 1 to 100, or the value "r" or the value "i" or the value "na"

My script looks like this, but it continues to allow duplicate entries of the "i" and the "r" when the
"i" is entered on the change* event. What is missing?

if (xfa.event.change!="" && !xfa.event.newText.match(/^[0-9]+(\+|-)?$|^(na?)?$|^(r)?$|^(i)/)) {
xfa.event.change ="";
xfa.host.beep("3");
}

推荐答案

| ^ (na?)?
|^(na?)?


| ^(r)?


| ^(i)/)){

xfa.event.change ="";

xfa.host.beep(" 3");

}
|^(i)/)) {
xfa.event.change ="";
xfa.host.beep("3");
}


这篇关于如何将用户选择限制为三个选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆