How to parse HTML/DOM to set ID attributes
Submitted by Thursday, 19 June, 2008 - 09:23
on
I want to write a macro to automatically add id attribute for all specified tags (h2, h3, h4…),
when it is not set yet. (for example #h2-1, #h2-2, #h2-3…).
I wrote a simple javascript bookmarklet to do it,
but I dont’t know how to do it in beanshell macro.
Set IDs bookmarklet
How to write getElementsByTagName(tag) function?
Maybe just regular expression with returning beanshell replacement will work?
Then how to increment those IDs in regexp?
TIA,
takeshin
when it is not set yet. (for example #h2-1, #h2-2, #h2-3…).
I wrote a simple javascript bookmarklet to do it,
but I dont’t know how to do it in beanshell macro.
Set IDs bookmarklet
How to write getElementsByTagName(tag) function?
Maybe just regular expression with returning beanshell replacement will work?
Then how to increment those IDs in regexp?
TIA,
takeshin