Log In · Register

 
HOW COME MY SCRIPT DOESNT WORK?
rosedoll
post Feb 18 2007, 11:11 PM
Post #1


Senior Member
***

Group: Member
Posts: 78
Joined: Apr 2006
Member No: 391,072



<script type="text/javascript">

function replaceWords()
{
var oldWords = new Array(
"Name:",
"Birthday:",
"Gender:",
"Interests:",
"Expertise:",
"Email:",
"MSN:",
"Member Since:",
"eprops",
"eprop",
"comments",
"comment",
"email it",
"Subscriptions",
"My Blogrings",
"Posting Calendar",
"Get Involved!",
"Subscribe to D_ollylolita",
"read my profile",
"sign my guestbook",
"Next 5",
"Previous 5");

var newWords = new Array(
"<img src= http://i4.photobucket.com/albums/y105/ai_a...Iconns/icon.gif border=0>",
" ",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...Iconns/icon.gif border=0>",
" ",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...onns/ichigo.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a..._Iconns/389.gif border=0>[朋友仔)ADD我就同我UP聲先<img src= http://i4.photobucket.com/albums/y105/ai_a..._Iconns/389.gif border=0>",
"◤如上na◢ <img src=

http://i4.photobucket.com/albums/y105/ai_a...Iconns/icon.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...nns/eicon21.gif border=0>

玫瑰種植日期:",
"<marquee behavior=alternate width=37><img src= http://i4.photobucket.com/albums/y105/ai_a...conns/bara3.gif

border=0></marquee> ROZE ",
" *我的薔薇 <marquee behavior=alternate width=37><img src= http://i4.photobucket.com/albums/y105/ai_a...conns/bara7.gif border=0></marquee>",
" 我的薔薇* <marquee behavior=alternate width=37><img src=

http://i4.photobucket.com/albums/y105/ai_a...conns/bara3.gif border=0></marquee>",
" ROZE <marquee behavior=alternate width=37><img src=

http://i4.photobucket.com/albums/y105/ai_a...conns/bara7.gif border=0></marquee>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...i_Iconns/30.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...nns/01d_005.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...P3993840N26.gif border=0> <img src=

http://i4.photobucket.com/albums/y105/ai_a...P3993840N26.gif border=0>&pound;&laquo;<img src=

http://i4.photobucket.com/albums/y105/ai_a...P3993840N26.gif border=0> ",
"<marquee behavior=alternate width=55><img src=http://i4.photobucket.com/albums/y105/ai_aangle/Minii_Iconns/04-09.gif

border=0></marquee><marquee behavior=alternate width=55><img src=

http://i4.photobucket.com/albums/y105/ai_a...conns/04-09.gif border=0></marquee>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...Iconns/icon.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_aangle/i16-01.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...Iconns/icon.gif border=0>",
"<img src= http://i4.photobucket.com/albums/y105/ai_a...Iconns/icon.gif border=0>",
"<marquee behavior=alternate width=37><img src= http://i4.photobucket.com/albums/y105/ai_a..._Iconns/754.gif

border=0></marquee> ",
"<marquee behavior=alternate width=37><img src= http://i4.photobucket.com/albums/y105/ai_a..._Iconns/753.gif

border=0></marquee>");


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]);
if(navigator.userAgent.toLowerCase().indexOf('compatible')>0){collections[k]

[i].innerHTML=replacement;//please use supported code at http://help.xanga.com/codes.htm
}
break;
}
}
}
}
}
}
replaceWords();
</script>
 
 
Start new topic
Replies
threepointone
post Feb 25 2007, 11:55 AM
Post #2


Senior Member
****

Group: Member
Posts: 122
Joined: Feb 2005
Member No: 106,057



I'd agree. Usually, when there's an error on one javascript code on a page, all the subsequent scripts just don't run. For all we know, this could be completely fine, but another script on your page is having problems. Seeing that you've got some more serious problems to fix on your page, you probably should get everything else fixed up.

If you still think the problem might be in this code, the most common error I see is a missing or additional quote character. Remember, the computer is stupid and can't tell if your a quote character is part of the thing you want to replace or the end of a string.
 

Posts in this topic


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: