Email conversation
From | Chris Dyck |
To | Me |
Subject | combining functions and if statements |
Date | 10 December 2003 00:09 |
ok, I'm on an avid gamers site which has html variables like
[current_username] which it imports from some database somewhere.
the one I am specifically dealing with is [area_name] which give the
section your currently in.
i got the following script from a scripting site for using avatars and
signatures (which is applied to the template of a flat reply page):
<iframe src="list.php" name="list" width="0" height="0" onload="writeSig()"></iframe>
<script language="JavaScript">
function writeSig() {
users = document.list.users
for (var i = 1; i < users.length; i++) {
if (document.all.sig[count].value == users[i][0]) {
if (users[i][1].length > 0) {document.all.sig[count].innerHTML = '<hr>' + users[i][1]}
else {document.all.sig[count].innerHTML='';}
}
}
[loop:replies]
for (var i = 1; i < users.length; i++) {
if (document.all.sig[count].value == users[i][0]) {
if (users[i][1].length > 0) {document.all.sig[count].innerHTML = '<hr>' + users[i][1]}
else {document.all.sig[count].innerHTML='';}
}
if (document.all.av[count].value == users[i][0]) {
if (users[i][2].length > 0) {document.all.av[count].innerHTML = '<center><img src=\"'+
users[i][2]+'\" height=\"'+users[i][3]+'\" width=\"'+users[i][4]+'\"></center>'}else
{document.all.av[count].innerHTML='';}
}
}
[endloop:replies]
}
</script>
the entire source can be found at http://xxx.xxxxxxxxxx.xxx/xxxxxxx/xxxxx.xxx
what i want to do is make it so that the signature only shows up on the
board designated test (eg, if you put [area_name] in the code and you were
in the test board it would show up on the page as test
can you help?
From | Me |
To | Chris Dyck |
Subject | Re: combining functions and if statements |
Date | 10 December 2003 10:02 |
Chris,
Not sure what language they are writing in here. [loop:replies] is NOT
valid JavaScript, and it looks like they are using a server side script to
produce the page, which dynamically creates the page and the JavaScripts.
Is this correct? Do you know what language? because it doesn't look like
any that I am familiar with (although I do understand it - I assume it is
something like ASP).
Another point, that script is written VERY badly. It will only work in
Internet Explorer and some versions of Opera. You really should ask the
author of the script to rewrite it to work in all major browsers (using
document.getElementById etc.).
If you mean that you only want to make it show up if [area_name] == 'test',
I think that is easy, but I am assuming that I correctly understand the
server side language:
function writeSig() {
if('[area_name]' != 'test') { return; }
...
Not entirely sure of the question here, sorry, so if I got this wrong, it
will help if you can give me a few more details:
Do you have the URL of the test page so I can see what you are trying to do?
What do you mean by 'board designated test'? What is 'board'? is it the
name of a forum? or is it <div id="test">?
For the best results, you should contact the original author of the script
and ask them to rewrite it for you, as they would be a lot quicker than me
at editing their own script.
Tarquin - author of http://www.howtocreate.co.uk