Html Page not working with my code?
Page 1 of 1
Html Page not working with my code?
The code below is the code to one of my html pages. It works in preview mode but it does not work after I submit it. In other words, when I click the buttons in preview mode it works. But after I submit the code into the page, then go to view it and push the buttons it does not work. Does anyone have any idea as to why its doing that? Also, this is the link: http://www.roleplayandwritinghaven.com/Test-h3.htm
- Code:
<html>
<head>
<title>Experience Generator</title>
<script type="text/javascript">
function Expearned()
{
var A= Math.round(Math.random()*100);
var B= document.formselect.numbers.value;
document.getElementById("myDiv").innerHTML = B*A + ' Experience Points Earned';
}
var Rosuto=["Elf","Lvl 10","Thief","","HP 430","Str 34","Agi 55","Int 43","Dmg 55"];
var Brynzyn=["Centaur","Lvl 1","Warrior","","HP 200","Str 22","Agi 17","Int 5","Dmg 22"];
var Dalphire=["Elf","Lvl 1","Black Mage","","HP 140","Str 10","Agi 15","Int 24","Dmg 26"];
var Azazael=["Elf","Lvl 1","Thief","","HP 180","Str 13","Agi 23","Int 15","Dmg 23"];
var Draèk=["Hume","Lvl 1","Warrior","","HP 165","Str 16","Agi 13","Int 15","Dmg 15"];
var Godric=["Hume","Lvl 1","Archer","","HP=155","Str 15","Agi 19","Int 10","Dmg 19"];
var Gortog=["Dwarf","Lvl 1","Warrior","","HP=205","Str 24","Agi 7","Int 10","Dmg 26"];
function showIt(which) {
var n = which.value;
if (n=="") {return false}
n = n.toLowerCase().replace(/\b[a-z]/g,function(w){return w.toUpperCase()});
try {
eval(n);
}
catch(e) {
//alert(e.name + "\n" + e.message); // showing alert error
alert("The name " + n + " does not exist, please choose another one.");
document.getElementById("gname").value = "";
document.getElementById("gname").focus();
return false;
}
nv = eval(n);
var result = n + "<br>";
result = result + nv[0] + "<br>";
result = result + nv[1] + "<br>";
result = result + nv[2] + "<br>";
result = result + nv[3] + "<br>";
result = result + nv[4] + "<br>";
result = result + nv[5] + "<br>";
result = result + nv[6] + "<br>";
result = result + nv[7] + "<br>";
result = result + nv[8] + "<br>";
document.getElementById("details").innerHTML = result;
}
</script>
</head>
<body>
<div align="center">
Select Level
<form name='formselect'>
<select name='numbers' > <option value=1 selected>One</option> <option value=2>Two</option> <option value=3>Three</option> <option value=4>Four</option> <option value=5>Five</option> </select>
<BR><BR>
<INPUT TYPE='button' VALUE="Earn Experience" onclick='Expearned()'>
<BR><BR>
</form>
<div id='myDiv'></div>
<BR><BR>
Enter Character's Name
(Use _ for space between first and last name)
<input type = "text" name = "gname" id = "gname">
<input type ="button" value = "Get Details" onclick = "showIt(gname)">
<br><br>
<div id = details></div>
</div>
</body>
</html>
Chris Hickingbottom- Forumember
- Posts : 25
Reputation : 0
Language : English
Similar topics
» html page as I created to be my home page not working
» Html code not working
» HTML code not working at all
» HTML Code Not working
» Html page not working
» Html code not working
» HTML code not working at all
» HTML Code Not working
» Html page not working
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum