473,498 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running Javascript Command from toolbar

I'm working with an internal website with a form with a bunch of
checkboxes indicating records that I need to work with. Part of my job
is printing all those records, meaning I need to check each box that I
want to print. I'd like to do it all at once, but I don't have access
to the code of the website, and they won't add a simple javascript
button that will do this.

So, I want to create a javascript command on my IE toolbar that will
run through the browser window and check all the boxes on the form. Is
this possible? If so, how?

Chad Lupkes
Seattle

Nov 3 '06 #1
5 3342
uoL
hi,
here it is:

javascript: alert("hi!");void(0);

Regards,
uoL

chadlupkes wrote:
I'm working with an internal website with a form with a bunch of
checkboxes indicating records that I need to work with. Part of my job
is printing all those records, meaning I need to check each box that I
want to print. I'd like to do it all at once, but I don't have access
to the code of the website, and they won't add a simple javascript
button that will do this.

So, I want to create a javascript command on my IE toolbar that will
run through the browser window and check all the boxes on the form. Is
this possible? If so, how?

Chad Lupkes
Seattle
Nov 3 '06 #2
VK
So, I want to create a javascript command on my IE toolbar that will
run through the browser window and check all the boxes on the form. Is
this possible? If so, how?
Would you compromize for an item in your Favorites? In such case you
could use bookmarklet.

Copy the code below and save as HTML page. Open in your browser, right
click on "Check all" link and choose "Add to Favorites" ("Bookmark this
link" or however it's called in your UA). In IE you will get security
warning: click OK.

Now simply choose "Check all" bookmark any time you need it. Please not
that this code is very "greedy": it will check on whatever is
"checkable" on the current page. If it's too much, readjust the
algorithm and replace the bookmarlet with the new code.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>

<body>
<form method="post" action="">
<input type="checkbox" name="checkbox1" value="checkbox">
<input type="checkbox" name="checkbox2" value="checkbox">
<input type="checkbox" name="checkbox3" value="checkbox">
</form>

<p><a href="
javascript:function checkAll() {
var elm = document.getElementsByTagName('input');
var len = elm.length;
for (var i=0; i<len; ++i) {
if ('checked' in elm[i]) {
elm[i].checked = true;
}
}
}
void checkAll();
">Check all</a></p>

</body>
</html>

Nov 3 '06 #3
That worked!

Thanks!

Chad

VK wrote:
So, I want to create a javascript command on my IE toolbar that will
run through the browser window and check all the boxes on the form. Is
this possible? If so, how?

Would you compromize for an item in your Favorites? In such case you
could use bookmarklet.

Copy the code below and save as HTML page. Open in your browser, right
click on "Check all" link and choose "Add to Favorites" ("Bookmark this
link" or however it's called in your UA). In IE you will get security
warning: click OK.

Now simply choose "Check all" bookmark any time you need it. Please not
that this code is very "greedy": it will check on whatever is
"checkable" on the current page. If it's too much, readjust the
algorithm and replace the bookmarlet with the new code.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>

<body>
<form method="post" action="">
<input type="checkbox" name="checkbox1" value="checkbox">
<input type="checkbox" name="checkbox2" value="checkbox">
<input type="checkbox" name="checkbox3" value="checkbox">
</form>

<p><a href="
javascript:function checkAll() {
var elm = document.getElementsByTagName('input');
var len = elm.length;
for (var i=0; i<len; ++i) {
if ('checked' in elm[i]) {
elm[i].checked = true;
}
}
}
void checkAll();
">Check all</a></p>

</body>
</html>
Nov 3 '06 #4
Ok, it did work, however it's affecting form elements besides the check
boxes, and causing the site to act strange. Here's the code for the
checkboxes:

<INPUT type="checkbox" id="chkProcess" class="Data" title='Check to
select this item.' onchange="SetHidden(this,
document.all('hidProcess'))">

I don't know what the hidProcess is or what it does. My guess is that
it affects the POST command somehow, but that's over my head.

All of them are the same. Is there another dHTML element that I could
reference, preferrably ID or referencing the type="checkbox"?

Chad

VK wrote:
So, I want to create a javascript command on my IE toolbar that will
run through the browser window and check all the boxes on the form. Is
this possible? If so, how?

Would you compromize for an item in your Favorites? In such case you
could use bookmarklet.

Copy the code below and save as HTML page. Open in your browser, right
click on "Check all" link and choose "Add to Favorites" ("Bookmark this
link" or however it's called in your UA). In IE you will get security
warning: click OK.

Now simply choose "Check all" bookmark any time you need it. Please not
that this code is very "greedy": it will check on whatever is
"checkable" on the current page. If it's too much, readjust the
algorithm and replace the bookmarlet with the new code.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>

<body>
<form method="post" action="">
<input type="checkbox" name="checkbox1" value="checkbox">
<input type="checkbox" name="checkbox2" value="checkbox">
<input type="checkbox" name="checkbox3" value="checkbox">
</form>

<p><a href="
javascript:function checkAll() {
var elm = document.getElementsByTagName('input');
var len = elm.length;
for (var i=0; i<len; ++i) {
if ('checked' in elm[i]) {
elm[i].checked = true;
}
}
}
void checkAll();
">Check all</a></p>

</body>
</html>
Nov 3 '06 #5
VK

chadlupkes wrote:
Ok, it did work, however it's affecting form elements besides the check
boxes, and causing the site to act strange. Here's the code for the
checkboxes:

<INPUT type="checkbox" id="chkProcess" class="Data" title='Check to
select this item.' onchange="SetHidden(this,
document.all('hidProcess'))">

I don't know what the hidProcess is or what it does. My guess is that
it affects the POST command somehow, but that's over my head.

All of them are the same. Is there another dHTML element that I could
reference, preferrably ID or referencing the type="checkbox"?
That's getting shaky as I don't know neither what does SetHidden do.
"document.all" usage suggests a pure coding so whatever it does - it
can besides be done in some "creative" way. Without holding any
responsability, try first to change bookmarklet to:

javascript:function checkAll() {
var elm = document.getElementsByTagName('input');
var len = elm.length;
for (var i=0; i<len; ++i) {
if (('checked' in elm[i]) && (elm[i].className == 'Data')) {
elm[i].checked = true;
}
}
}
void checkAll();
also you can try to override listeners:

javascript:function checkAll() {
var loophole = new Function();
var tmp = null;
var elm = document.getElementsByTagName('input');
var len = elm.length;
for (var i=0; i<len; ++i) {
if (('checked' in elm[i]) && (elm[i].className == 'Data')) {
tmp = elm[i].onchange;
elm[i].onchange = loophole;
elm[i].checked = true;
elm[i].onchange = tmp;
}
}
}
void checkAll();

Nov 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2005
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected...
9
4496
by: CW | last post by:
I wrote an HTML based chat application. The front end is built entirely on HTML + javascript. Essentially, I have a hidden frame that's refreshed frequently and any new messages are displayed in...
0
1779
by: Lauren Quantrell | last post by:
I use the following code to create text edit fields and command buttons in my toolbars: Function CreateToolbarObject(myObjectType as integer) Dim newObject Select Case myObjectType Case 1...
14
4943
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
3
1387
by: wizofaus | last post by:
Hi. I'm playing around with developing a web-based application that needs to use a java applet in order to implement some advanced functionality that I don't see as being feasible with pure...
1
4097
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET...
1
2452
by: jmohan | last post by:
Dear Sir/Madam, I develop a website in asp.net with c#. And also, I develop a toolbar in the toolbar studio separately. Aim of the Website: Enabling the visitors to become a member of our...
1
1689
by: jmohan | last post by:
Hi everyone, I am developing a website using asp.net with C#. And I developed a toolbar using javascript like google and yahoo toolbar which is placed in the browser separately. Toolbar has...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.