When the TEST button is clicked, the alert message returns "finalName is [object Attr] Frame Color: [object Attr] ".
How can I make "finalName" return the concatenated strings initialName + currentFrameColor?
I'm new to javascript (and programming). I'm having trouble understanding the handling of objects vs. strings.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"<html xmlns=" xml:lang="en">
<head>
<script type="text/javascript">
<!--
function SymError(){
return true;
}
window.onerror = SymError;
var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes){
return (new Object());
}
window.open = SymWinOpen;
//-->
</script>
<!-- Frame Detector -->
<script type="text/javascript">
<!--
//Returns Selected Button
function getSelectedButton(buttonGroup){
for (var i = 0; i < buttonGroup.length; i++) {
if (buttonGroup.checked) {
return i;
}
}
return 0;
}
//Frame Options Detector
function frameOptionDetect(form) {
var i = getSelectedButton(form.frmType);
document.getElementById("total").value = form.frmType.value;
document.getElementById("amount").value = form.frmType.value;
}
//Frame Color Detector
function frameColorDetect(form) {
var i = getSelectedButton(form.frameColor);
var initialName = document.getElementById("item_name").getAttributeNode("value");
var currentFrameColor = form.frameColor.getAttributeNode("value");
var combinedName = initialName.value += " Frame Color: " + currentFrameColor.value;
var finalName = document.getElementById("item_name").getAttributeNode("value");
finalName = combinedName;
alert("finalName is " + finalName);
}
//-->
</script>
</head>
<body>
<!-- Display Image -->
<table name="Full_Page_Table" cellpadding="5" cellspacing="3">
<tr>
<td>
<!-- Start Canned Script -->
<form action=" method="post">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value="bobbi@bobbibecker.com">
<input type="hidden" name="item_name" id="item_name" value="bobbi becker print(s): "Pickin Apples""/>
<input type="hidden" name="item_number" value="003000">
<input type="hidden" name="amount" id="amount" value="">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-ShopCartBF">
<fieldset style="background-color:#CCCCCC" style="padding-left:5; padding-right:5; padding-top:4; padding-bottom:10">
<h3>Frame Specifications</h3>
<!-- Frame Color -->
<div><b>Color</b></div><hr>
<input type="radio" name="frameColor" id="frameColor" onclick="frameColorDetect(this.form)" checked="checked" value="Red" onchange="frameColorDetect(this.form)"/>
<label for="frameColor">Red</label>
<img src="file:///F:/0_WEB/bobbibecker/NEW_<br/>
<input type="radio" name="frameColor" id="frameColor" onclick="frameColorDetect(this.form)" value="Gold" onchange="frameColorDetect(this.form)"/>
<label for="frameColor">Gold</label>
<img src="file:///F:/0_WEB/bobbibecker/NEW_<hr>
<!-- Frame type -->
<div><b>Framing Options</b></div>
<input type="radio" name="frmType" value="15" onclick="frameOptionDetect(this.form)" checked="checked" name="rad"/>
<label for="frmType">Sponged Frame</label>
<br/>
<input type="radio" name="frmType" value="20" onclick="frameOptionDetect(this.form)" name="rad"/>
<label for="frmType">Hand Grained Frame</label>
<br/>
<input type="radio" name="frmType" id="frmType" value="10" onclick="frameOptionDetect(this.form)" name="rad"/><label for="frmType">Unframed</label>
<br/>
</fieldset>
<br/>
Total US $ <input type="text" id="total" name="total" value="15" size ="6"/>
<br/><br/>
<input type="image" src="images/thumbs/website/x-click-but22.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
<input type="image" src="images/thumbs/website/view_cart_02.gif" alt="Make payments with PayPal - it's fast, free and secure!" onclick="document.forms.viewcart.target = 'paypal'; document.forms.viewcart.submit (); return false;"/>
<p><input type="button" name="Viewer" value="TEST"
onclick="frameColorDetect(this.form)"/></p>
</form>
</td>
<td>
<img src="images/autumn_pickinapples.jpg" alt=""><br/>
<div align="center">
<!--Season=autumn--><span id="PrintName" class="">Pickin Apples</span>
<!--id=003000--><span id="PrintSize" class="">8x10</span>
</div>
</td>
</tr>
</table>
</body>
</html>
How can I make "finalName" return the concatenated strings initialName + currentFrameColor?
I'm new to javascript (and programming). I'm having trouble understanding the handling of objects vs. strings.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"<html xmlns=" xml:lang="en">
<head>
<script type="text/javascript">
<!--
function SymError(){
return true;
}
window.onerror = SymError;
var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes){
return (new Object());
}
window.open = SymWinOpen;
//-->
</script>
<!-- Frame Detector -->
<script type="text/javascript">
<!--
//Returns Selected Button
function getSelectedButton(buttonGroup){
for (var i = 0; i < buttonGroup.length; i++) {
if (buttonGroup.checked) {
return i;
}
}
return 0;
}
//Frame Options Detector
function frameOptionDetect(form) {
var i = getSelectedButton(form.frmType);
document.getElementById("total").value = form.frmType.value;
document.getElementById("amount").value = form.frmType.value;
}
//Frame Color Detector
function frameColorDetect(form) {
var i = getSelectedButton(form.frameColor);
var initialName = document.getElementById("item_name").getAttributeNode("value");
var currentFrameColor = form.frameColor.getAttributeNode("value");
var combinedName = initialName.value += " Frame Color: " + currentFrameColor.value;
var finalName = document.getElementById("item_name").getAttributeNode("value");
finalName = combinedName;
alert("finalName is " + finalName);
}
//-->
</script>
</head>
<body>
<!-- Display Image -->
<table name="Full_Page_Table" cellpadding="5" cellspacing="3">
<tr>
<td>
<!-- Start Canned Script -->
<form action=" method="post">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value="bobbi@bobbibecker.com">
<input type="hidden" name="item_name" id="item_name" value="bobbi becker print(s): "Pickin Apples""/>
<input type="hidden" name="item_number" value="003000">
<input type="hidden" name="amount" id="amount" value="">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-ShopCartBF">
<fieldset style="background-color:#CCCCCC" style="padding-left:5; padding-right:5; padding-top:4; padding-bottom:10">
<h3>Frame Specifications</h3>
<!-- Frame Color -->
<div><b>Color</b></div><hr>
<input type="radio" name="frameColor" id="frameColor" onclick="frameColorDetect(this.form)" checked="checked" value="Red" onchange="frameColorDetect(this.form)"/>
<label for="frameColor">Red</label>
<img src="file:///F:/0_WEB/bobbibecker/NEW_<br/>
<input type="radio" name="frameColor" id="frameColor" onclick="frameColorDetect(this.form)" value="Gold" onchange="frameColorDetect(this.form)"/>
<label for="frameColor">Gold</label>
<img src="file:///F:/0_WEB/bobbibecker/NEW_<hr>
<!-- Frame type -->
<div><b>Framing Options</b></div>
<input type="radio" name="frmType" value="15" onclick="frameOptionDetect(this.form)" checked="checked" name="rad"/>
<label for="frmType">Sponged Frame</label>
<br/>
<input type="radio" name="frmType" value="20" onclick="frameOptionDetect(this.form)" name="rad"/>
<label for="frmType">Hand Grained Frame</label>
<br/>
<input type="radio" name="frmType" id="frmType" value="10" onclick="frameOptionDetect(this.form)" name="rad"/><label for="frmType">Unframed</label>
<br/>
</fieldset>
<br/>
Total US $ <input type="text" id="total" name="total" value="15" size ="6"/>
<br/><br/>
<input type="image" src="images/thumbs/website/x-click-but22.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
<input type="image" src="images/thumbs/website/view_cart_02.gif" alt="Make payments with PayPal - it's fast, free and secure!" onclick="document.forms.viewcart.target = 'paypal'; document.forms.viewcart.submit (); return false;"/>
<p><input type="button" name="Viewer" value="TEST"
onclick="frameColorDetect(this.form)"/></p>
</form>
</td>
<td>
<img src="images/autumn_pickinapples.jpg" alt=""><br/>
<div align="center">
<!--Season=autumn--><span id="PrintName" class="">Pickin Apples</span>
<!--id=003000--><span id="PrintSize" class="">8x10</span>
</div>
</td>
</tr>
</table>
</body>
</html>