473,231 Members | 1,863 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,231 software developers and data experts.

[Greasemonkey] Getting value between tags

3
What I got:
[HTML]<font color="#ffffcc" face="Tahoma, Arial, Helvetica" size="+1">testA</font>
<font color="#ffffcc" face="Tahoma, Arial, Helvetica" size="+1">test1</font>
[/HTML]

What I want:
[HTML]<font color="#ffffcc" face="Tahoma, Arial, Helvetica" size="+1">testA <a href="http://loginpage.php?login=testA">login</a></font>
<font color="#ffffcc" face="Tahoma, Arial, Helvetica" size="+1">test1<a href="http://loginpage.php?login=test1">login</a></font>
[/HTML]
Now I know how to insert the <a> tag but I can't get the "testA", "test1" values. Any help would be greatly appreciated .
Sep 6 '08 #1
5 2885
Dormilich
8,658 Expert Mod 8TB
first, drop the <font> tags, they're deprecated since you can do styling with css.

if you have say
[HTML]<span>test1</span>[/HTML]
you can use
Expand|Select|Wrap|Line Numbers
  1. {span}.firstChild.nodeValue
  2. {span}.value
  3. {span}.innerHTML
there are several ways to get the desired span object...

regards
Sep 6 '08 #2
morbo
3
first, drop the <font> tags, they're deprecated since you can do styling with css.

if you have say
[HTML]<span>test1</span>[/HTML]
you can use
Expand|Select|Wrap|Line Numbers
  1. {span}.firstChild.nodeValue
  2. {span}.value
  3. {span}.innerHTML
there are several ways to get the desired span object...

regards
I have no acces to the page, that is why I need grease monkey
Sep 6 '08 #3
Dormilich
8,658 Expert Mod 8TB
I have no acces to the page, that is why I need grease monkey
this will result in quite a bit of work. the main problem you have (without access to the page) is to address the right font tags. you probably have to get all font tags, check if they contain a link and then you can read the text.

maybe you can provide a link, so I can have a look at the html (this could make things easier).

regards
Sep 6 '08 #4
morbo
3
http://www.hswn.dk/hobbit/servers/servers.html


What I am trying to accomplish is to have an icon next to the server names that connects to a login page and gives the server name as get variable.

ps: the span element is not in my version (runs on secure local network)
Sep 6 '08 #5
Dormilich
8,658 Expert Mod 8TB
nasty bit of tree walking there....

ok, first you need the right table
Expand|Select|Wrap|Line Numbers
  1. var tbl = document.getElementsByTagName("table")[2]; // 3rd table
then select the table rows
Expand|Select|Wrap|Line Numbers
  1. var rows = tbl.childNodes; // tbl.firstChild.childNodes for IE
now get the font tags (loop through the rows) and the text
Expand|Select|Wrap|Line Numbers
  1. var text = rows[i].firstChild.getElementsByTagName("font")[0].firstChild.nodeValue;
I didn't test it, but I think it should work this way.

regards
Sep 6 '08 #6

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

Similar topics

2
by: Newton | last post by:
I'm having some issues with a greasemonkey script i've made (nothing serious, and you'll notice that by the mess). I made it to learn javascript properly at first but it ended handy and now i'm...
1
by: MKR | last post by:
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"...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.