Search code examples
javascriptselectcheckboximacros

How do I set the Select All "checkbox" iMacros Without using the button "Play (Loop)"


How do I set the Select All "checkbox" iMacros Without using the button "Play (Loop)" and without making the tag to 50 lines since our site I visited was no key select all and I need to choose 50 categories. Here's the code that I use and try

This version javascript Imacros:

var macro;
macro =  "CODE:";
macro +=  "TAG POS={{i}} TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES" + "\n"; 
macro +=  "WAIT SECONDS=0" + "\n"; 
for(i=1;i<=50;i++){
iimSet("i",i);
iimPlay(macro);
}

This version Imacros

TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=2 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=3 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=4 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=5 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=6 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=7 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=8 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=9 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
TAG POS=10 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES
---------
TAG POS=50 TYPE=INPUT:CHECKBOX FORM=ID:post_form ATTR=NAME:category[] CONTENT=YES

I want is just one line version of iMacros


Solution

  • Maybe this could help you:

    URL GOTO=javascript:{var<SP>chkBoxes=document.getElementsByName("category[]");for(i=0;i<chkBoxes.length;i++)chkBoxes[i].checked=true;undefined;}