cyfer65 2 Posted March 7, 2012 Report Share Posted March 7, 2012 (edited) I need a lil help with a greasemonkey script im trying to make..I need it to take all the Forms in the source HTML <form>(.*)</form>And place them all before/above all the Tables in the HTML <table>(.*)</table>so originally it looks like this <div><table></table><form></form></div> I want to change it to this <div><form></form><table></table></div> How would I do this? Edited March 7, 2012 by cyfer65 Quote Link to post Share on other sites
justsomeguy 1,135 Posted March 7, 2012 Report Share Posted March 7, 2012 What do you have so far? Quote Link to post Share on other sites
cyfer65 2 Posted March 7, 2012 Author Report Share Posted March 7, 2012 Not vary good with regex expressions, the code doesnt work, i was just trying to match all the data between the the <form> and <table> tags but I cant seem to get it to work.. I think it needs to also include matching linefeeds or carriage returns in the (.*) brackets but I'm not familiar with this regex replace functions or variables.. var DIV = document.getElementsByTagName("div");for(i=0;i<DIV.length;i++){ DIV[i].innerHTML = DIV[i].innerHTML.replace(/\<form\>(.*)\<\/form\>/g, '');DIV[i].innerHTML = DIV[i].innerHTML.replace(/\<table\>(.*)\<\/table\>/g, '');} Quote Link to post Share on other sites
justsomeguy 1,135 Posted March 7, 2012 Report Share Posted March 7, 2012 Check the reference here for the notes about the dot character: https://developer.mo..._Objects/RegExp Quote Link to post Share on other sites
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.