A
Alexander Paul
Hi!
I'm a newbie to JavaScript who tries to code his first (useful)
Greasemonkey script.
I'd like to do the following:
<p class="someclass">text01 <b>text02</b> text03</p>
=>
<p class="someclass">text01 text02 text03</p>
I tried something like this
var nodes = document.evaluate(
"//p[@class='someclass']/font[1]/text()[1]",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < nodes.snapshotLength; i++) {
node = nodes.snapshotItem(i);
s = node.data;
s = s.replace(/<[\b|\B]>/gi,'');
s = s.replace(/<\/[\b|\B]>/gi,'');
node.data = s;
}
Unfortunately, it doesn't work.
I would be most grateful for any help or ideas...
Alex
I'm a newbie to JavaScript who tries to code his first (useful)
Greasemonkey script.
I'd like to do the following:
<p class="someclass">text01 <b>text02</b> text03</p>
=>
<p class="someclass">text01 text02 text03</p>
I tried something like this
var nodes = document.evaluate(
"//p[@class='someclass']/font[1]/text()[1]",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < nodes.snapshotLength; i++) {
node = nodes.snapshotItem(i);
s = node.data;
s = s.replace(/<[\b|\B]>/gi,'');
s = s.replace(/<\/[\b|\B]>/gi,'');
node.data = s;
}
Unfortunately, it doesn't work.
I would be most grateful for any help or ideas...
Alex