DY

Trying to get phpBB to create a link on their new forum link type of forum. Unfortunately you can't pass variables from PHP to the link. To get around that, got this going:

Created a forum thats a link with http://changeme as the link

at the overall footer I threw in

<script type="text/javascript">
New = "<a href=\"http://domain.com/players.php?pid={S_PLAYER_ID}\" class=\"forumtitle\">Roster</a>"
a = document.getElementsByTagName("dt")
for (i=0; i<a.length; i++)
if((a[i].innerHTML.match("<a href=\"http://changeme\" class=\"forumtitle\">Roster</a>"))){a[i].innerHTML=a[i].innerHTML.replace("<a href=\"http://changeme\" class=\"forumtitle\">Roster</a>",New);
}
</script>

Works in Safari/FF but of course IE doesn't. What is a good workaround or recoding to do here?

Thanks!

add a comment
0

4 Answers

  • Votes
  • Oldest
  • Latest
ZI

I don't really know whats the problem. I barely know JS but:
Don't care about the IE, nobody smart uses it nowadays 🙂
Some things just don't work on there.

add a comment
0
DY

Well I have been looking around at posts about replace not working in IE, so instead decided to find a different script:

https://www.ozzu.com/forum/200402/js-search-replace

It appears to be working! A quick touch up will fix it all, thanks Ozzu!

add a comment
0
AW

Hello quick response as I just found out what was wrong with my code (had a similar problem with IE) instead of using the replace with text like you did use a regular expression

before I had this

.replace('<img src="images/correct.png" alt="valid" width="20px">', "");

but it wouldnt work on IE but then I changed it to

.replace(/^<.*">/g, "");

and it worked! just be sure to not use "" or '' around the regular expression!

Hope it helps 🙂

Ada J wong

add a comment
0