简体   繁体   English

根据href传递的变量更改Checkbox Checked值

[英]Change Checkbox Checked Value based upon variable passed by href

Using Javascript and HTML Form 使用Javascript和HTML表单

Page 1: Simple Link passing two variables (page1var1=xxxx and page1var=yyyy) separated by an "&" symbol 页面1:简单链接传递两个变量(page1var1 = xxxx和page1var = yyyy),用“&”符号分隔

Page 2: Use Javascript to "split" the two variables either side of the "&" into page2var1 and page2var2 第2页:使用JavaScript将“&”两侧的两个变量“拆分”为page2var1和page2var2

So now page2var1=xxxx and page2var2=yyyy (successfully done already) 所以现在page2var1=xxxxpage2var2=yyyy (已经成功完成)

How do I use these variables in page 2 to: 如何在第2页中使用这些变量来:

  1. Check a form input checkbox (ie "put a tick in the box") which has the ID/Name) Page2var1 (ie xxxx) 选中具有ID /名称的表单输入复选框(即“在方框中打勾”)Page2var1(即xxxx)
  2. Put the variable page2var2 (ie yyyy) into the value of a fixed form textarea 将变量page2var2(即yyyy)放入固定形式textarea的值中

Something like this: 像这样:

document.GetElementById(Page2var1).checked = true;
document.GetElementById(page2var2).value = 'whatever text'

Nothing google wouldn't help you with. Google会帮您的忙。

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

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