更改复选框基于href传递的变量的检查值 [英] Change Checkbox Checked Value based upon variable passed by href

查看:115
本文介绍了更改复选框基于href传递的变量的检查值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JavaScript和HTML表单



第1页:简单链接传递两个变量(page1var1 = xxxx和page1var = yyyy),用&符号



第2页:使用Javascript分割两个变量的& into page2var1 and page2var2



现在 page2var1 = xxxx page2var2 = yyyy (成功完成)



如何在第2页中使用这些变量:



<
  • 检查表单输入复选框(即在框中打勾),其中包含ID /名称)Page2var1(即xxxx)

  • 将变量page2var2 (例如yyyy)转换为固定格式textarea的值


  • 解决方案

    / p>

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

    t帮助你。


    Using Javascript and HTML Form

    Page 1: Simple Link passing two variables (page1var1=xxxx and page1var=yyyy) separated by an "&" symbol

    Page 2: Use Javascript to "split" the two variables either side of the "&" into page2var1 and page2var2

    So now page2var1=xxxx and page2var2=yyyy (successfully done already)

    How do I use these variables in page 2 to:

    1. Check a form input checkbox (i.e. "put a tick in the box") which has the ID/Name) Page2var1 (i.e. xxxx)
    2. Put the variable page2var2 (i.e. yyyy) into the value of a fixed form textarea

    解决方案

    Something like this:

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

    Nothing google wouldn't help you with.

    这篇关于更改复选框基于href传递的变量的检查值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆