473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help needed writing a Greasemonkey user script

MKR
I need some help writing a Greasmonkey user script. An application that
I use generates HTML pages with tags like this:

<input type="button" name="9999" value="1234567890"
onClick="showitem('1234567890'); return false">

Sometimes I just want to copy the item number (i.e. the "value"
attribute), other times I actually want to click the button and see the
item. Right now I can see the item number as a button label, but I
cannot copy its value. What I want to do is to use a Greasmonkey user
script to replace the buttons with some like:

<a href="./info/1234567890.htm">1234567890</a>

Can someone show me how to do that in JavaScript?

Many thanks.
Mar 1 '07 #1
1 1572
MKR wrote:
<input type="button" name="9999" value="1234567890"
onClick="showitem('1234567890'); return false">

Sometimes I just want to copy the item number (i.e. the "value"
attribute), other times I actually want to click the button and see the
item. Right now I can see the item number as a button label, but I
cannot copy its value. What I want to do is to use a Greasmonkey user
script to replace the buttons with some like:

<a href="./info/1234567890.htm">1234567890</a>
// assuming that input type="button" is the first element with
// that name 9999:
var button = document.getElementsByName('9999')[0];
if (button != null) {
var link = document.createElement('a');
link.href = './info/' + button.value + '.htm';
link.appendChild(document.createTextNode(button.va lue));
button.parentNode.replaceChild(link, button);
}
--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 1 '07 #2

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

Similar topics

8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
3
by: Csaba Gabor | last post by:
Firefox's configuration settings (Prefs.js) can be accomplished via the interface at about:config. Q1. Is there any such setting that can be repeatedly altered via javascript (in a vanilla...
27
by: Scott | last post by:
I've been trying to come up with a way to ensure user input is coming from the form on my site, and not auto-submitted from elsewhere, and I don't want to use the "enter the code shown in the...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
by: 9icj4u613jeqrx8 | last post by:
Hi, I need some help with IE browser programming (in .NET). I'm trying to add a button to the IE toolbar, and on the click of the button open a popup window with a remote URL. Secondly, I'm...
6
by: Jim Wooseman | last post by:
I'm trying to use Greasemonkey to add form validation to some Web pages (whose construction is otherwise out of my control). To boil it down to a simple test case, the combination of the original...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.