Cory94bailly Posted September 30, 2010 Share Posted September 30, 2010 I'm currently making a GreaseMonkey script for a Live Support script that I use on a daily basis. Here's the Live Support's HTML (Client-Side): <td align="center" nowrap="nowrap"><a href="javascript:void(0)" onclick="window.open('http://*****.com/livesupport/request.php?action=accept&sessionid=***&requestid=***&sid=***&userid=***&l=admin&x=1', '***', 'status=no,scrollbars=no,menubar=no,resizable=no,location=no,width=450,height=635,screenX=50,screenY=100')"><b>ACCEPT</b></a> | <a href="javascript:parent.window.do_reject(***)">busy</a></td> And here's what I have so far (I was testing): var busy = document.getElementsByTagName('tr')[4].getElementsByTagName('td')[0].getElementsByTagName('a')[1]; busy.parentNode.removeChild(busy); My code is working well but it only removes the bolded part in the above quote. Yeah, I know.. That's all the code I posted is supposed to do... But I'm trying to completely remove " | <a href="javascript:parent.window.do_reject(***)">busy</a></td>" I looked around regex and I couldn't really understand how to use it or if it would even work for what I'm trying to accomplish. It might be hard to understand what I'm asking for.. I'm just trying to remove this: | [b]<a href="javascript:parent.window.do_reject(***)">busy</a></td> from the quote at the top of the thread. If you need more explaining, I will gladly do that Does anybody have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/214788-help-removing-a-few-things/ Share on other sites More sharing options...
Adam Posted October 1, 2010 Share Posted October 1, 2010 I'm not really sure what you're trying to do here, but you won't be able remove (just) them as a single node. As you said you could use regex, which to match it would require: / \| \[b\]<a href\="javascript:parent\.window\.do_reject\(\*\*\*\)">busy<\/a><\/td>/ Then you could use the .replace() method to remove the string: var td = document.getElementsByTagName('tr')[4].getElementsByTagName('td')[0].innerHTML; td.replace(/ \| \[b\]<a href\="javascript:parent\.window\.do_reject\(\*\*\*\)">busy<\/a><\/td>/, ''); Not tested, but you should be able to tweak it to get it working. Quote Link to comment https://forums.phpfreaks.com/topic/214788-help-removing-a-few-things/#findComment-1117886 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.