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.

Experience Generator isn't working.

View previous topic View next topic Go down

Solved Experience Generator isn't working.

Post by Chris Hickingbottom on October 1st 2010, 4:25 am

I just made an experience generator using a prompt screen and it was successful. But then I wanted to make one that you can type your number in and press the box to see the exp earned. So, I did just that, but I ran into one problem..
Code:

var A= Math.round(Math.random()*100);

var B= input.text();

function Expearned()
{
document.write(Exp=B*A);
document.write(" Experience Points Earned");
}

</script>
</head>
<body>
<FORM ACTION="#" NAME=LeveltoExp>
Enter Celsius
<INPUT TYPE=TEXT NAME="Enter Level" SIZE=3>
<BR><BR>
<INPUT TYPE=BUTTON VALUE="Earn Experience"
ONCLICK=" Expearned()
  + 'is '
  + ' Experienced Earned'">
<BR><BR>
<TEXTAREA NAME=Resultexp COLS=30 ROWS=2 DISABLED>
</TEXTAREA>
</FORM>

It works except for the var B= input.textarea(); part. Anyone have any suggestions??


Last edited by Chris Hickingbottom on October 4th 2010, 10:42 am; edited 1 time in total

Chris Hickingbottom
Forumember

Posts : 25
Reputation : 0
Language : English

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Skelly Man on October 1st 2010, 5:16 am

ugh? what is it supposed to do
Code:
<script>
var A= Math.round(Math.random()*100);

var B= input.text();

function Expearned()
{
document.write(Exp=B*A);
document.write(" Experience Points Earned");
}

</script>
</head>
<body>
<FORM ACTION="#" NAME=LeveltoExp>
Enter Celsius
<INPUT TYPE=TEXT NAME="Enter Level" SIZE=3>
<BR><BR>
<INPUT TYPE=BUTTON VALUE="Earn Experience"
ONCLICK=" Expearned()
  + 'is '
  + ' Experienced Earned'">
<BR><BR>
<TEXTAREA NAME=Resultexp COLS=30 ROWS=2 DISABLED>
</TEXTAREA>
</FORM>
That make the var B=etc. things go away but im still confused what you want to do?

Skelly Man
Forumember

Male Posts : 130
Reputation : 0
Language : english
Location : NSW, Australia

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Chris Hickingbottom on October 1st 2010, 5:33 am

ok, sorry here is the lastest edit i have of this code.

Code:

<html>

<head>
<title>Experience Generator</title>
<script type="text/javascript">
var A= Math.round(Math.random()*100);

var B= input.text();

function Expearned()
{
document.write(Exp=B*A);
document.write(" Experience Points Earned");
}

</script>
</head>
<body>
<FORM ACTION="#" NAME=LeveltoExp>
Enter Level
<INPUT TYPE=TEXT NAME="Enter Level" SIZE=3>
<BR><BR>
<INPUT TYPE=BUTTON VALUE="Earn Experience"
ONCLICK=" Expearned()
  + 'is '
  + ' Experienced Earned'">
<BR><BR>
<TEXTAREA NAME=Resultexp COLS=30 ROWS=2 DISABLED>
</TEXTAREA>
</FORM>
</body>
</html>

What this is suppose to do is first randomly selects a number from 0-100. It then takes that and multiplies it by the level that the user puts in and displays it in the text area. Do you get what I am saying??

Chris Hickingbottom
Forumember

Posts : 25
Reputation : 0
Language : English

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Skelly Man on October 1st 2010, 5:40 am

ugh so if i put in 3 and the numer is 20 i would get 60xp? right?

Skelly Man
Forumember

Male Posts : 130
Reputation : 0
Language : english
Location : NSW, Australia

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Chris Hickingbottom on October 1st 2010, 5:46 am

Skelly, yep that is the general idea, but you will not see the number that it randomly selects, only the product of them.^_^
Got any suggestions?

Chris Hickingbottom
Forumember

Posts : 25
Reputation : 0
Language : English

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Skelly Man on October 1st 2010, 5:52 am

ugh im trying to think how i could do tat :/

Skelly Man
Forumember

Male Posts : 130
Reputation : 0
Language : english
Location : NSW, Australia

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Chris Hickingbottom on October 1st 2010, 5:57 am

what do you mean?? There is one part that needs correcting... grr I need someone to help me fix the line with var B=input.text();

I would help soooo much!!

Chris Hickingbottom
Forumember

Posts : 25
Reputation : 0
Language : English

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by Chris Hickingbottom on October 4th 2010, 6:25 am

I fixed this problem... this is the resulting code

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';

}
</script>
</head>
<body>
<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>
</body>
</html>

Chris Hickingbottom
Forumember

Posts : 25
Reputation : 0
Language : English

Back to top Go down

Solved Re: Experience Generator isn't working.

Post by ankillien on October 4th 2010, 1:37 pm

Solved > Locked

ankillien
Energetic

Posts : 5198
Reputation : 129
Language : English, XHTML, CSS, JS, PHP, SQL

http://www.webartzforum.com/

Back to top Go down

View previous topic View next topic Back to top


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