Posts Tagged ‘checkbox’

JavaScript Select All/Check All Checkboxes

April 24th, 2009 No comments

In my day-to-day SEO work, there are many sites I use that have a bunch of checkboxes on a single page. For example, in SEO, this is usually to check the box beside websites I want to trade links with. Well this gets tidious, so I went on the hunt for some kind of Javascript, Firefox-addon or mini-program that would do this with 1 click of the mouse. Here’s what I figured out…

At the top of my Firefox, I have a Links bar. I simply created a new link, and added the following code as the URL:

javascript:(function(){ function toggle(box){ temp=box.onchange; box.onchange=null; box.checked=!box.checked; box.onchange=temp; } var x,k,f,j; x=document.forms; for (k=0; k</X.LENGTH;>

I honestly don’t recall where I found this – I’ve been using it for several weeks. But thanks to whoever I found it from. (If I find the site, or you email me, I’ll put the link here.)


Basically what that does is go through each form on a page and toggle the checkboxes on and off. It’s great as a quick-link in my Links bar – I can load the page, click that link (checking all of the check boxes on a page) and click submit. Done!

Categories: Programming Tags: ,