Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/470.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用javascript传递输入值_Javascript_Jquery - Fatal编程技术网

如何使用javascript传递输入值

如何使用javascript传递输入值,javascript,jquery,Javascript,Jquery,我有5种以上的卡类型,每种卡都作为不同的验证,当用户更改卡类型时,reqpattern将更改,我需要在callonkeyup功能中传递更改后的reqpattern。 请告诉我如何在callonkeyup函数中传递更改的reqpattern callonkeyup(this,'AccountNumber',this.getAttribute('reqpattern')) <input type="tel" reqpattern="^[0-9]+\$" onblur="callonke

我有5种以上的卡类型,每种卡都作为不同的验证,当用户更改卡类型时,
reqpattern
将更改,我需要在
callonkeyup
功能中传递更改后的
reqpattern
。 请告诉我如何在
callonkeyup
函数中传递更改的
reqpattern

callonkeyup(this,'AccountNumber',this.getAttribute('reqpattern'))

<input type="tel" reqpattern="^[0-9]+\$" 
  onblur="callonkeyup(this,'AccountNumber',this.getAttribute('reqpattern'));" 
  value="" id="AccountNumber"/>
callonkeyup(这个,'AccountNumber',这个.getAttribute('reqpattern'))

为什么不在函数调用中传递req模式:

 <input type="tel" onblur="callonkeyup(this,'AccountNumber', '^[0-9]+\$');" value="" id="AccountNumber"/>

我无法用您的代码重现您的问题。 我已经试过下面的代码片段,你能在手上检查一下吗

<!DOCTYPE html>
<html>
<head> 
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<input type="tel" reqpattern="^[0-9]+\$" 
  onblur="callonkeyup(this,'AccountNumber',this.getAttribute('reqpattern'));" 
  value="" id="AccountNumber"/>
<input type="tel" reqpattern="^[a-z]+\$" 
  onblur="callonkeyup(this,'AccountName',this.getAttribute('reqpattern'));" 
  value="" id="AccountName"/>

<script>
function callonkeyup(obj,txtType,rpattern)
{
    alert(obj);
    alert(txtType);
    alert(rpattern);
}

</script>
</body>
</html>

试验
函数callonkeyup(obj、TXTYPE、rpattern)
{
警报(obj);
警报(TXTYPE);
警报(rpattern);
}

如果有任何问题,请告诉我。

为什么不粘贴到目前为止您所做的工作,以便我们更好地帮助您。。。编辑:感谢编辑@Jayeshhow用户更改卡片类型???单击某些元素或使用下拉列表等。Hi Reinder Wit,reqpattern是动态的,当用户更改卡类型时,它将更新