Need Javascript Injection

Discussion in 'JavaScript' started by domainsurfer, Jan 18, 2008.

  1. #1
    Need a javascript injection code to tick all checkboxes in a page with namess such as checkbox[0] to checkbox[145]

    Please help.
     
    domainsurfer, Jan 18, 2008 IP
  2. mjamesb

    mjamesb Member

    Messages:
    88
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    48
    #2
    The code below should help get you on the right track


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>

    <body>

    <form name="testform" id="testform">
    <input type="checkbox" value="1"><br>
    <input type="checkbox" value="2"><br>
    <input type="checkbox" value="3"><br>
    <input type="checkbox" value="4"><br>
    </form>
    <input type="button" onclick="checkthem()">

    <script language="javascript">
    function checkthem()
    {
    var myinputs = document.getElementsByTagName("input");
    for (i=0;i< myinputs.length; i++)
    {
    if (myinputs.type == "checkbox")
    {
    myinputs.checked = true;
    }
    }
    }


    </script>
    </body>
    </html>
     
    mjamesb, Jan 18, 2008 IP
  3. domainsurfer

    domainsurfer Well-Known Member

    Messages:
    922
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #3
    I dont know how to use this code.


    I would need a javascript injection to type in the address bar which solves the problem..

    Thanks for the solution anyway. Appreciate the effort.

     
    domainsurfer, Jan 18, 2008 IP