The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.

Create a free forum like this one.

Html Page not working with my code?

Go down

Html Page not working with my code?

Post by Chris Hickingbottom on October 5th 2010, 10:31 pm

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:

<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   {
catch(e) {
//alert( + "\n" + e.message);  // showing alert error
alert("The name " + n + " does not exist, please choose another one.");
document.getElementById("gname").value = "";
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;



<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>
<INPUT TYPE='button' VALUE="Earn Experience" onclick='Expearned()'>
<div id='myDiv'></div>
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)">
<div id = details></div>

Chris Hickingbottom

Posts : 25
Reputation : 0
Language : English

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum