lundi 5 décembre 2016

How to translate from iMacros to Javascript

I would like to test out a grid of 24 checkboxes arranged in a 4x8 grid pattern on my web page. For every possible combination i want to press a button, then copy the contents of a textArea and add it to another textarea.

I have only a little experience in java so please bear with me as I will try my best to explain.

I started out in imacros but I eventually realized that their language wasn't going to be enough, so I've been trying to turn it into javascript.

The problem is I dont know how to translate the code properly.

First of all - I was easily able to access each checkbox by using the macros plugin as all I needed to do was click on the box and the line of code would appear. The checkboxes are numbered from 1 to 24. For example, the following line would tick off checkbox number 24:

TAG POS=24 TYPE=INPUT:CHECKBOX FORM=NAME:pldq1 ATTR=* CONTENT=YES

However I find this hard to figure out how to write in javascript. All I've found is:

document.getElementById("checkbox").checked = true;

Which obviously does not specify which of the 24 checkboxes, and I would not know how to adjust it do do so.

The rest of code that I'm trying to "translate" from iMacros to javascript:

TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:answerpldq1 ATTR=*//Press the button
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:outputpldq1 ATTR=NAME:code EXTRACT=TXT
    SET !CLIPBOARD 
    TAB T=2 //next tab
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:id_c-value CONTENT=
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:id_d-value CONTENT=
    TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=*//submit
    TAB T=1

I hope my question is understandable! Any help is much appreciated.

Aucun commentaire:

Enregistrer un commentaire