简体   繁体   English

如何通过php或jquery中的url get变量设置passord字段值

[英]How to set passord field value by url get variable in php or jquery

我可以设置用户名字段值,但不能设置密码字段值。

我敢肯定<input type="password" value="value" />可以在大多数浏览器中使用。

Look at here http://www.w3schools.com/html/html_forms.asp . 在这里看http://www.w3schools.com/html/html_forms.asp Use type="password" instead of type="input" 使用type="password"而不是type="input"

assuming you have a input field: 假设您有一个输入字段:

<input type="password" name="ooxx" />

and using jQuery, you can set its value at run-time: 并使用jQuery,您可以在运行时设置其值:

// 333 is the new value
jQuery("input[type='password']").val(333)

see the live example here: http://jsfiddle.net/AeJjy/ 在此处查看实时示例: http : //jsfiddle.net/AeJjy/

also, you are able to use the method below the get the value from url. 同样,您也可以使用下面的方法从url获取值。

/**
 * Usage:  given :  http://some.site.com?para1=hi 
 * para1 = params("para1")     => para1 = "hi"
 * @param {Object} name
 */
function params(name)
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return ""; 
  else
    return results[1];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM