HTML - 如何在加载时预先填充已知值的表单域? [英] HTML - How to pre-populate form field with known value upon load?
问题描述
我有这个网页,说Home.html,有链接到其他员工相关的网站。有一个说www.SomeSite.com/HR.xyz,它有一个登录表单。有3个字段:UserId,Password和Company。公司总是一样的,例如MYCO。如何更新Home.html页面,以便当用户点击链接www.SomeSite.com/HR.xyz时,它会自动使用MyCo填充公司字段?
$
$ b
< input autocomplete ='off'class ='loginInput' tabindex ='3'type =textname =companyid =companyvalue =maxlength = '50'size =25>
我通过在URL中输入以下内容尝试了以下内容,但它不起作用(没有错误,只是没有填充公司字段:www.SomeSite.com/HR.xyz?company=
感谢您的建议!
更改 value
属性:
< input autocomplete ='off'class ='loginInput 'tabindex ='3'type =text
name =companyid =companyvalue =MyComaxlength = '50'size =25>
I have this web page, say Home.html, that has links to other employee-related web sites. There is one, say www.SomeSite.com/HR.xyz, where it has a form to login. There are 3 fields: UserId, Password, and Company. The company is always the same, e.g. MyCo. How can I update the Home.html page so that when the user clicks on the link to , www.SomeSite.com/HR.xyz, it automatically populates the Company field with "MyCo"?
I looked at the DOM and found the following:
<input autocomplete='off' class='loginInput' tabindex='3' type="text" name="company" id="company" value="" maxlength='50' size="25">
I tried the following by entering it in the URL and it did not work (no error, just didn't populated the "company" field: www.SomeSite.com/HR.xyz?company=MyCo.
Thanks for advice!
Change the value
attribute:
<input autocomplete='off' class='loginInput' tabindex='3' type="text"
name="company" id="company" value="MyCo" maxlength='50' size="25">
这篇关于HTML - 如何在加载时预先填充已知值的表单域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!