By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,188 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,188 IT Pros & Developers. It's quick & easy.

Unchecking all checkboxes (or after a certain checkbox) function

Death Slaught
P: 1,137
I play a game that when your backpack fills with items (the limit is 45) you must choose items to discard by unchecking their box. This is very annoying and time consuming so I was wondering if it were possible to create a Javascript function to be saved as a bookmark, and when used it prompts for the checkbox to start at (so it won't discard items that I want to keep) and discards all items after that point. So my main question is, is it possible for Javascript to manipulate a webpage in this way?

Here is part of the code used:

Expand|Select|Wrap|Line Numbers
  1. <FORM ACTION = maze.php METHOD = post name=battle><input type=hidden name=discard value=1>  
  2.              <br>You cannot carry all of these items!
  3.              Select 45 items to keep.
  4.              The rest will be discarded.<table><tr><td><input type=checkbox name=Item0 value=1 checked></td>
  5.                <td>Forest Sloth Fang (72)</td>
  6.                <td>animal part</td><td><input type=checkbox name=Item1 value=1 checked></td>
  7.                <td>Ridiculous Refreshing Potion (20)</td>
  8.                <td>Restores 5000 HP and 5000 Mana</td></tr><tr><td><input type=checkbox name=Item2 value=1 checked></td>
  9.                <td>Ridiculous Refreshing Potion (20)</td>
  10.                <td>Restores 5000 HP and 5000 Mana</td><td><input type=checkbox name=Item3 value=1 checked></td>
  11.                <td>Ridiculous Refreshing Potion (20)</td>
  12.                <td>Restores 5000 HP and 5000 Mana</td></tr><tr><td><input type=checkbox name=Item4 value=1 checked></td>
  13.                <td>Ridiculous Refreshing Potion (20)</td>
  14.                <td>Restores 5000 HP and 5000 Mana</td><td><input type=checkbox name=Item5 value=1 checked></td>
  15.                <td>Ridiculous Refreshing Potion (13)</td>
  16.                <td>Restores 5000 HP and 5000 Mana</td></tr><tr><td><input type=checkbox name=Item6 value=1 checked></td>
  17.                <td>Scroll of Antaria Warp (2)</td>
  18.                <td></td><td><input type=checkbox name=Item7 value=1 checked></td>
  19.                <td>Keen Claymore</td>
  20.                <td>huge, 20d12 damage, +6 attack</td></tr><tr><td><input type=checkbox name=Item8 value=1 checked></td>
  21.                <td>Keen Claymore</td>
  22.                <td>huge, 20d12 damage, +6 attack</td><td><input type=checkbox name=Item9 value=1 checked></td>
  23.                <td>Keen Claymore</td>
  24.                <td>huge, 20d12 damage, +6 attack</td></tr><tr><td><input type=checkbox name=Item10 value=1 checked></td></tr></table>
(' . ')
Jan 27 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
@Death Slaught
Yes, GreaseMonkey in Firefox and User JavaScript in Opera. There are also alternatives for other browsers.
Jan 27 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.