Experience Generator isn't working.
3 posters
Page 1 of 1
Experience Generator isn't working.
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..
It works except for the var B= input.textarea(); part. Anyone have any suggestions??
- 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
Re: Experience Generator isn't working.
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>
Skelly Man- Forumember
- Posts : 130
Reputation : 0
Language : english
Location : NSW, Australia
Re: Experience Generator isn't working.
ok, sorry here is the lastest edit i have of this code.
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??
- 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
Re: Experience Generator isn't working.
ugh so if i put in 3 and the numer is 20 i would get 60xp? right?
Skelly Man- Forumember
- Posts : 130
Reputation : 0
Language : english
Location : NSW, Australia
Re: Experience Generator isn't working.
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?
Got any suggestions?
Chris Hickingbottom- Forumember
- Posts : 25
Reputation : 0
Language : English
Re: Experience Generator isn't working.
ugh im trying to think how i could do tat
Skelly Man- Forumember
- Posts : 130
Reputation : 0
Language : english
Location : NSW, Australia
Re: Experience Generator isn't working.
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!!
I would help soooo much!!
Chris Hickingbottom- Forumember
- Posts : 25
Reputation : 0
Language : English
Re: Experience Generator isn't working.
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
Re: Experience Generator isn't working.
Solved > Locked
ankillien- Energetic
- Posts : 5198
Reputation : 129
Language : English, XHTML, CSS, JS, PHP, SQL
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum