ID:777503
 
Code:
<head>
<title>About the Wolves</title>
<body bgcolor="silver">
<script type="text/javascript" language="JavaScript">

function menuAction(menu)
{
switch(menu.options[menu.selectedIndex].value)
{

case "cmd1":

document.title = "The Message Board";





/* WARNING WARNING WARNING*/
/* YOU HAVE TO PUT A \ BEFORE " WHEN DOING IMAGES EXAMPLE: imsrc \"usr\" */


var body2 = "<br>"+
"<center><table border=\"1\">"+
"<tr>"+
"<td>Messages:<br>"+
"</tr>"+
"<tr>"+
"<td>Try to make 500,000$ for the alliance per day<br>"+
"Dont take more then your ranking would allow(check rankings page)<br>"+
"Comments from shwb1: Bark1 to me :P<br>"+
"<br>"+
"The only one who can edit the den is me and flare at the moment<br>"+
"<br>"+
"Dear flare,<br>"+
"There is a new way of editing the den it is a bit complex but it provides us with easy way of<br>"+
"getting around when i get on please ask me about it i will tell you<br>"+
"~Love shwb1<br>"+
"PS:barkbarkbark"+
"</tr>"+
"</table>"+
"<br>"+
"<br>"+
"<br>"+
"<I><b><center>Notice:</b></I><I>Exposing the wolf code to any outsider will result in your termination from the pack and your country being destroyed.</center>";

document.getElementById("span").innerHTML = body2;

break;

case "cmd2":

document.title = "The Wolves";

var body2 = "<br>"+
"<center>Shwb1(Leader)<br>"+
"Type: Direwolf<br>"+
"CodeName: DW<br>"+
"Comments: BarkBarkBark<br>"+
"Image:</center>"+
"<center><img src=\"http://images.wikia.com/lon/images/f/f8/Savage_Dire_Wolf.png\" /></center>"+
"<br>"+
"<br>"+
"<br>"+
"<br>"+
"<br>"+
"<br>"+
"<center>Flare_silverbend(Commander)<br>"+
"Type: Czecholovakian Wolfdog<br>"+
"CodeName: CSW<br>"+
"Comments: Epic Wolfdog<br>"+
"Image:</center>"+
"<center><img src=\"http://dl.dropbox.com/u/34703508/csw.jpg\" /></center>"+

"<br>"+
"<br>"+
"<br>"+
"<I><b><center>Notice:</b></I><I>Exposing the wolf code to any outsider will result in your termination from the pack and your country being destroyed.</center>";
document.getElementById("span").innerHTML = body2;

break;

case "cmd4":

document.title = "About the Wolves";

var body2 = "<br>"+
"<center>The wolves are an alliance of many different wolves<br>"+
"from all over we are a band of wolves who do not treat traitorism well<br>"+
"if you leave us and you arnt trusted, you die<br>"+
"<br>"+
"We use our own code(Wolf Code) and if that gets out its dangerous to us<br>"+
"so that is why we kill deserters if they arnt trusted<br>"+
"The Wolves are founded by Flare_Silverbend and is now owned by shwb1"+
"<br>"+
"<br>"+
"<br>"+
"<I><b><center>Notice:</b></I><I>Exposing the wolf code to any outsider will result in your termination from the pack and your country being destroyed.</center>"+
"<br>";
document.getElementById("span").innerHTML = body2;

break;
}

}
</script>
<select onChange="menuAction(this)">

<option value="cmd4">About the Wolves</option>

<option value="cmd2">The Wolves</option>

<option value="cmd1">The Message Board</option>

</select>
</head>
<body">
<span id="span">
<center>The wolves are an alliance of many different wolves<br>
from all over we are a band of wands who do not treat traitorism well<br>
if you leave us and you arnt trusted, you die<br>
<br>
We use our own code(Wolf Code) and if that gets out its dangerous to us<br>
so that is why we kill deserters if they arnt trusted<br>
The Wolves are founded by Flare_Silverbend and \"Co-owned\"(As he likes to think ;P) by shwb1
<br>
<br>
<br>
<I><b><center>Notice:</b></I><I>Exposing the wolf code to any outsider will result in your termination from the pack and your country being destroyed.</center>

</span>
</body>


Problem description:in my guide on wolves this is the script using HTML but when i use it whenever i switch from the wolves to the message board or something to something(whenever i move from one place to another) i get a error:
An error has occurred in the script on this page
line: 80
Char: 1
Error: Unknown runtime error
Code: 0
UR:: file:///C:/Users/Home/Documents/BYOND/cache/2571d67c.htm

Do you want to continue running scripts on this page?


can someone please help me?


Use Control+G to find line 80 and show us which one it is.
Bit more helpful info:
on line its always between case cmd and break;
78:"<center>Notice:Exposing the wolf code to any outsider will result in your termination from the pack and your country being destroyed.</center>";
79:document.getElementById("span").innerHTML = body2;
80:
81:break;

82:case "cmd3":
i seemed to left out a part

also this is what the new errors are:

51:case "cmd2":

83:case "cmd3":

157:case "cmd4":
158:
159:document.getElementById(span").innerHTML = body2;

break;
177:}
178:
179:}
180:</script>



if the line hade nothing on it i went outwards from it til i hit something that could be a problem
Upon some research, it looks like strings cannot be used in switch statements.
meaning i cant use
switch(menu.options[menu.selectedIndex].value)?
or
document.getElementById("span").innerHTML = body2;
It means you cannot use:

case "cmd2":


You'll need to use integers or something.
i still get the same error when i switch to if statements
Then I'm not sure.
:/
i found the problem:
document.getElementById("span").innerHTML
but i still dont know how to fix
document.getElementById();

That is a method to grab an element according to it's ID. You are telling it to get an element with the 'span' ID, but thats not going to work as span is a reserved word since it is an actual element itself. Assign it a different ID and try it.

Edit: After reading a little bit, I'm not sure the words are reserved. Do you actually have an element with the 'span' ID? That function only looks for ID's, if you want to single out an element that doesn't have an ID you'll need a different function and a for loop.

var a = document.getElementByTagName('span'), b;
for(x=0;x<a.length;x++){
if(a[x].innerHTML.match(/regexp/g)){
b = a[x].innerHTML;
}
}


If the element has a class, then do like..

var a = document.getElementByTagName('span'), b;
for(x=0;x<a.length;x++){
if(a[x].className == "className"){
b = a[x].innerHTML;
}
}
ugh same error dont spose "text1" is reserved too?
:/ is that the only way?
also is that byonf or html coding?
Thats Javascript, which you were using there, notice the
<script type="text/javascript">


If you don't know how to get what I gave you working, I'm not sure what to tell you.. it's good to invest in some knowledge about Javascript. Is this for a game you're programming?
nope :P
Error: Object doesnt support propertty or method 'getElementByTageName'
y u try 2 sabotage me bro :( i put in a DIV tag and it worked better cept for the code you game me(i understood what it meant before i added it if i dont its not my code)killed it lol
Page: 1 2