I’m taking my first class in JavaScript and walking through the simple exercises in the first chapter…it had me code a page with radio buttons that, when selected, displays a chunk of text in a text area box… the code is as follows:
document.write("<p><strong>Today’s special</strong>: ");
document.write(“Buy a large meat lover’s pizza<br />”);
document.write("and recieve a free Caesar salad ");
document.write(“and two liters of Diet Pepsi!</p>”);
var vegetarian = "Lots of mushrooms, black olives,
bell peppers, onions, artichoke hearts,
and fresh tomatoes. "
var hawaiian = “Overloaded with juciy pineapple,
smoked bacon, sliced ham, roasted red peppers,
provolone cheese, and mozzarella cheese on a
cheesy Parmesan crust.”
var meatLovers = “Loads of pepperoni, savory Italian
sausage, smoked bacon, hamburger, mushrooms,
and extra cheese.”
var theWorks = “An irresistible combination of
pepperoni, ham, and spicy Italian sausage,
fresh-sliced onions and green peppers,
gourmet baby portabella mushrooms, and ripe
back olives.”
var fourCheese = “Thin-crust pizza with a
four-cheese blend of mozzarella, Parmesan,
Romano, and Asiago, along with our special seasoning.”
</script>
<form name=“pizzaList” action=“” method=“get”>
<p>Click the buttons for a description of each pizza.</p>
<p>
<input type=“radio” name=“pizzas” onclick=“document.pizzaList.pizzaDesc.value=vegetarian” />
Vegetarian<br />
<input type=“radio” name=“pizzas” onclick=“document.pizzaList.pizzaDesc.value=hawaiian” />
Hawaiian<br />
<input type=“radio” name=“pizzas” onclick=“document.pizzaList.pizzaDesc.value=meatLovers” />
Meat Lovers<br />
<input type=“radio” name=“pizzas” onclick=“document.pizzaList.pizzaDesc.value=theWorks” />
The Works<br />
<input type=“radio” name=“pizzas” onclick=“document.pizzaList.pizzaDesc.value=fourCheese” />
Four Cheese</p>
<p>
<textarea name=“pizzaDesc” cols=“75” rows=“20”
style=“background-color: Transparent; border:
none; overflow: hidden; font: 10px tahoma;
color: #3F3F3F”></textarea></p>
</form>
Sorry if the formatting is weird, it didn’t copy over well. But as of now the radio buttons display, but nothing displays in the textarea…
If anyone has any advice for me, I’d be thankful! I can understand if it’s simple and I’m overlooking something, I’m very new to JavaScript…thank you!