Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Javascript problems... Help?  (Read 1396 times)

highmax28

  • Bay Watcher
  • I think this is what they call a tantrum spiral...
    • View Profile
Javascript problems... Help?
« on: February 04, 2015, 08:33:57 pm »

I'm Highmax and I'm an idiot.

<insert everyone Hi max, then laughing because they got the joke>

I'm trying to work on my Javascript assignment, and I have to write a program that creates a form that has three radio buttons that allow you to pick a flower type and then have a single text box and the program spits out the form with your name, flower choice and a thank you note on it. Well, as I said, I'm an idiot and I can't understand the damn textbook when it comes to this. I seriously don't know whats supposed to be calling or executing what because 99% of these, from what I see, is calling random names and pulling it out of its arse at random times.

Seriously though, I don't know why its not working when I've done everything I THINK is right (and we all know that since I have no idea what I'm doing, assume I'm wrong somewhere). Here's the code

Code: [Select]
<html>
<head>
<!-- Program Name: flowerForm.html
Purpose: To create a form with the user's name and a choice of flower
Author: Specner Durette
Date last modified: February 3rd, 2015
-->
<script type="text/javascript">
//Variables
var flower;
var BR = "<br />";
var PA = "<p />";
var NL = "\n";

//Change the flower value when a radio button is pressed
function setType(flowerType) {
flower=flowerType;
}

function displayRequest() {
var fullName = document.FlowerForm.fullName.value;
var flower = document.FlowerForm.flowerPicked.value;

document.FlowerForm.FormRequest.value =
"Thank you for requesting information!" + NL + NL
+ "Name: " + fullName + NL
+ "Flower Inquiry About: " + flowerType
}
</script>
</head>
<body>
<h2>Flower Information Form</h2>
<form name="FlowerForm" action="">
<strong>Enter Your Full Name:</strong><br />
<input type="text" name="fullName" value="Full Name" size="40"><br />
<br />
<strong>Select the flower you wish to make an inquiry about</strong><br />
<input type="radio" name="flower" value="Roses" onclick="setType(flowerType)" />Roses<br />
<input type="radio" name="flower" value="Carnations" onclick="setType(flowerType)" />Carnations<br />
<input type="radio" name="flower" value="Daisies" onclick="setType(flowerType)" />Dasies<br />

<input type="button" name="resquestButton" value = "Display Request" onclick="displayRequest()" /><p />
<textarea name ="FormRequest" readonly="true" value = "" rows="8" cols="50"></textarea><br />
</form>
</body>
</html>

For reference, its Case 3-4/3-5 in the textbook Principles of Program Design: Solving Problems with JavaScript by Paul Addison
Logged
just shot him with a balistic arrow, i think he will get stuned from that >.>

"Guardian" and Sigfriend Of Necrothreat
Jee wilikers, I think Highmax is near invulnerable, must have been dunked in the river styx like achilles was.
Just make sure he wears a boot.

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: Javascript problems... Help?
« Reply #1 on: February 04, 2015, 08:34:32 pm »

Might want to try in the coder thread.
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

highmax28

  • Bay Watcher
  • I think this is what they call a tantrum spiral...
    • View Profile
Re: Javascript problems... Help?
« Reply #2 on: February 04, 2015, 08:52:59 pm »

Might want to try in the coder thread.
Thanks, I'll move it there
Logged
just shot him with a balistic arrow, i think he will get stuned from that >.>

"Guardian" and Sigfriend Of Necrothreat
Jee wilikers, I think Highmax is near invulnerable, must have been dunked in the river styx like achilles was.
Just make sure he wears a boot.

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Javascript problems... Help?
« Reply #3 on: February 05, 2015, 12:19:28 am »

<snip>Moved to other thread</snip>
« Last Edit: February 05, 2015, 12:26:37 am by Levi »
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout