cyfer65 Posted March 7, 2012 Share Posted March 7, 2012 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? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 7, 2012 Share Posted March 7, 2012 What do you have so far? Link to comment Share on other sites More sharing options...
cyfer65 Posted March 7, 2012 Author 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, '');} Link to comment Share on other sites More sharing options...
justsomeguy Posted March 7, 2012 Share Posted March 7, 2012 Check the reference here for the notes about the dot character: https://developer.mo..._Objects/RegExp Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.