[英]Setting input value to dynamic variable when onclick
I am trying to strip a parameter listingid
from the URL, and when onclick
it post a value of an input box as the listingid
, but i am not able to do so. 我试图剥离参数
listingid
从URL,当onclick
邮寄一个输入框的值listingid
,但我不能这样做。
Is it possible to do so? 有可能这样做吗?
function getpic( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return null;
else
return results[1];
}
var frank_param1 = gup( 'Listingid' );
HTML 的HTML
<input type="hidden" name="listingid" onclick="value=list_param">
您可以为此使用Jquery
$('input[name="listingid"]').val(getpic( 'Listingid' ))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.