HELP, script |
HELP, script |
![]()
Post
#1
|
|
![]() Member ![]() ![]() Group: Member Posts: 10 Joined: Jul 2004 Member No: 35,349 ![]() |
im tryin to change text but the script confuses me..... is this right?
QUOTE <script type="text/javascript">
// // &copy; EasterEgg, http://www.xanga.com/easteregg // // For use at Xanga only. // // This script replaces any given word or text fragment with // whatever you want: new words and fragments, or even HTML! // // Actually it's pretty simple: add the words or fragments you // wish to replace to the array "oldWords" (each word placed // between double quotation marks, and separated by colons as you // can see below) and add their replacements to the array "newWords", // at the same position as the original words in "oldWords". // The example is pretty self-explaining. // // The script is case sensitive, meaning that if you add "something" // to "oldWords" array it will not recognize "SOMETHING", or "SoMetHInG". // // You can adjust the existing arrays in this code as you see fit, // as long as both arrays keep the same size (same amount of words // in both arrays), otherwise a script error will occur. // // Copy this entire code and paste in the webstats box at your // Look and Feel page. // // You're free to use this script as long as this comment remains intact, // and as long you won't use it to cripple the comments of your visitors; // after all, no one likes his/her words getting twisted... // function replaceWords() { // ***add the words or fragments you wish to replace below var oldWords = new Array( "Subscriptions", "sign my guestbook", "My Blogrings", "Posting Calendar", "Birthday:", "Gender:", "Member since:"); // *** add the replacing words or fragments below var newWords = new Array( "Chains", "Hit me up female dog", "This Thing", "Backwards ro Forwards?", "Born:", "Female:", "Died:"); allTableData = document.getElementsByTagName('td'); allTableHeaders = document.getElementsByTagName('th'); var collections = new Array(allTableData,allTableHeaders); for (var k = 0; k < collections.length; ++k ) { for (var i = 0; i < collections[k].length; ++i ) { if (collections[k][i].innerHTML.indexOf('TABLE') == -1) { for ( var n = 0; n < oldWords.length; ++n ) { var indx = collections[k][i].innerHTML.indexOf(oldWords[n]) while (indx != -1) { var replacement = ''; indx = collections[k][i].innerHTML.indexOf(oldWords[n]); replacement = collections[k][i].innerHTML.replace(oldWords[n], newWords[n]); collections[k][i].innerHTML = replacement; break; } } } } } } replaceWords(); </script> |
|
|
![]() ![]() |