Jump to content

Recommended Posts

Hello. how could I search all anchors

<a name="****A****">****B****</a>

And then edit the text part B.

 

Example, this

<a name="1202">Hello!</a>

would replace

<a name="1202">Hello! <small>ID#1202</small></a>

 

This is coming a greasemonkey script. Hopefully you can help.

thank you very much.

 

EDIT:

I coded this: (bookmarklet test)

javascript:function(){for(i=0;i<document.links.length;i++){if(document.links[i].name){document.links[i].innerHTML = "Test "+document.links[i].name+"";}};}();

but it didn´t work.

I got it fixed:

javascript:(function () {var anchors = document.getElementsByTagName('a');var length = anchors.length;for (i=0; i<length; i++){if(anchors[i].name){var vanha=anchors[i].innerHTML;anchors[i].innerHTML=""+vanha+" <span style='font-size:10px;color:black'><a href='javascript:prompt(\"URL:\", \""+location.href+"~no.paging#"+anchors[i].name+"\");'>ID</a></span>";}}})();

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.