Solved

JavaScript Object Required

Posted on 2011-03-06
2
759 Views
Last Modified: 2012-05-11
Hello Experts,

At the bottom of the attached code I have a symbol JavaScript where if a location checkbox is clicked, the content of the hidden field is copied into the textarea, otherwise the textarea is blank.

When I try, I keep getting object required at line 647.

Any ideas? Thank you
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <title>MyLocalAdvantage.com</title>
  <meta name="robots" content="index, follow" />
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
  <link href="css/style.css" rel="stylesheet" type="text/css" />
  <link rel="stylesheet" href="css/locked-column.css" type="text/css">
  <!--[if lte IE 7]><link href="css/iehacks.css" rel="stylesheet" type="text/css" />
	<![endif]-->
  <script type="text/javascript" src="js/jquery.js"></script>
  <!--[if IE 6]>
  <script type="text/javascript" src="js/ie6pngfix.js"></script>
  <script type="text/javascript">
    DD_belatedPNG.fix('img, ul, ol, li, div, p, a, h1, h2, h3, h4, h5, h6, span, input, textarea, td');
  </script>
  <![endif]-->
	<script type="text/javascript"> 
    $(document).ready(function(){
      $("a.choose_city").click(function(){
        $("div.select_city_box").slideToggle();
      });
    });
    
    function hide_login () {
		document.getElementById('cover').style.display='none';
	}
 
	var len = 0;
	
	function open_login () {	
		len += 2;
		document.getElementById('login_box').style.width = len * 3 + "px"
		document.getElementById('login_box').style.height = len * 1.8 + "px"
		document.getElementById('login_box').style.marginTop = 210 - len * 0.75 + "px"
		if (len == 2)
			document.getElementById('cover').style.display='block';	
		
		if (len < 100)
			setTimeout ("open_login();", 1);		
				
	}
	
	function show_login () {
		//len = 0;
		//open_login();	
		document.getElementById('cover').style.display='block';	
	}
	
	function validLogin() {
		if (frmLogin.txtEMail.value == ''){
			alert('Please provide e-mail address to login.');
			show_login();
			return false;			
		}
		if (frmLogin.txtPassword.value == ''){
			alert('Please provide password to login.');
			show_login();
			return false;
		}
		
		return true;
	}
</script>
  </script>
</head>
 
 
<body onLoad="pageLoad(); 
 
	
">
<a name="Login"> </a>
 
		<div id="cover">
			<div id="login_box">						
	     
         
        
        <div class="reg_login"> 
 <span class="message success_log">Please Sign in.</span>
<form name="frmLogin" action="login.asp" method="post" onSubmit="return validLogin();">
           
 <ul>
   <li><label>Email <span class="required">*</span></label> 
<input name="txtEMail" type="text" size="25" class="input_item" value="" maxlength="100" /></li>
              
   <li class="forgot"><label>Password <span class="required">*</span></label>
<input name="txtPassword" type="password" size="26" class="input_item" value="" maxlength="100" />
<span class="text"><a href="password-forgot.asp">Forgot your password?</a></span></li>
              
   <li>  <input class="btn" name="submit" type="submit" value="SIGN IN" onclick="hide_login();" />
         <input class="Skipbtn" name="submit" type="submit" value=""  onclick="hide_login(); return false;" /></li>
 
  </ul>
 </form>
 </div>
 
			</div>
		</div>	
 
 
<div class="page">
 
<!-- header -->
<div id="header">
  <div class="headerwpr">
 
    <!-- logo -->
    <div class="logo">
      <a href="home.asp"><img src="images/logo.png" alt="Home" width="287" height="105" title="Home" /></a>
    </div>
    <!-- / logo -->
    
    <!-- header links -->
    <div class="header_links">
    <!--
      <div class="select_city">
        <a class="choose_city">Choose City</a>
      </div>
      
      <div class="searchbox">
        <form action="" method="post">
          <ul>
            <li><input name="" type="text" value="" class="input_item" /></li>
            <li><input name="" type="submit" value="Get the Deal" class="submit" /></li>
          </ul>
        </form>
      </div>
    -->
    </div>
    <!-- / header links -->
  
  </div>
</div>
<!-- / header -->
 
<!-- select city box 
<div class="select_city_box">
  <div class="select_city_box_bg">
    <a class="choose_city">hide</a>
  
    <div class="canadian_provinces">
      <h3>Canadian Provinces</h3>
      <ul>
        <li><a href="">Alberta</a></li>
        <li><a href="">British Columbia</a></li>
        <li><a href="">Manitoba</a></li>
        <li><a href="">New Brunswick</a></li>
        <li><a href="">Newfoundland</a></li>
        <li><a href="">Northwest Territories</a></li>
        <li><a href="">Nova Scotia</a></li>
        <li><a href="">Nunavut</a></li>
        <li><a href="">Ontario</a></li>
        <li><a href="">Prince Edward Island</a></li>
        <li><a href="">Quebec</a></li>
        <li><a href="">Saskatchewan</a></li>
        <li><a href="">Yukon</a></li>
      </ul>
    </div>
    
    <div class="american_states">
      <h3>American States</h3>
      <ul>
        <li><a href="">Alabama</a></li>
        <li><a href="">Alaska</a></li>
        <li><a href="">Arizona</a></li>
        <li><a href="">Arkansas</a></li>
        <li><a href="">California</a></li>
        <li><a href="">Colorado</a></li>
        <li><a href="">Connecticut</a></li>
        <li><a href="">Delaware</a></li>
        <li><a href="">District of Columbia</a></li>
        <li><a href="">Florida</a></li>
        <li><a href="">Georgia</a></li>
        <li><a href="">Hawaii</a></li>
        <li><a href="">Idaho</a></li>
      </ul>
      <ul>
        <li><a href="">Illinois</a></li>
        <li><a href="">Indiana</a></li>
        <li><a href="">Iowa</a></li>
        <li><a href="">Kansas</a></li>
        <li><a href="">Kentucky</a></li>
        <li><a href="">Louisiana</a></li>
        <li><a href="">Maine</a></li>
        <li><a href="">Maryland</a></li>
        <li><a href="">Massachusetts</a></li>
        <li><a href="">Michigan</a></li>
        <li><a href="">Minnesota</a></li>
        <li><a href="">Mississippi</a></li>
        <li><a href="">Missouri</a></li>
      </ul>
      <ul>
        <li><a href="">Montana</a></li>
        <li><a href="">Nebraska</a></li>
        <li><a href="">Nevada</a></li>
        <li><a href="">New Hampshire</a></li>
        <li><a href="">New Jersey</a></li>
        <li><a href="">New Mexico</a></li>
        <li><a href="">New York</a></li>
        <li><a href="">North Carolina</a></li>
        <li><a href="">North Dakota</a></li>
        <li><a href="">Ohio</a></li>
        <li><a href="">Oklahoma</a></li>
        <li><a href="">Oregon</a></li>
        <li><a href="">Pennsylvania</a></li>
      </ul>
      <ul>
        <li><a href="">Rhode Island</a></li>
        <li><a href="">South Carolina</a></li>
        <li><a href="">South Dakota</a></li>
        <li><a href="">Tennessee</a></li>
        <li><a href="">Texas</a></li>
        <li><a href="">Utah</a></li>
        <li><a href="">Vermont</a></li>
        <li><a href="">Virginia</a></li>
        <li><a href="">Virgin Islands</a></li>
        <li><a href="">Washington</a></li>
        <li><a href="">West Virginia</a></li>
        <li><a href="">Wisconsin</a></li>
        <li><a href="">Wyoming</a></li>
      </ul>
    </div>
  
  </div>
</div>
<!-- / select city box -->
 
<!-- post header -->
<div class="post_header">
  <div class="rapidxwpr">
 
    <!-- header bar -->
    <div class="header_bar">
      <div class="slogan">Great Deals! Every Day! All Day!</div>
      <div class="header_but">
        <ul>
        
        	
 
					<li class="welcome"> Welcome, Media </li>
					<li class="welcome">|</li>
					
        <li class="welcome">0 items</li>
        <li class="welcome">|</li>
        <li class="welcome">$0.00</li>
        <li class="welcome">|</li>
        <li class="welcome"><a href="cart.asp"><img src="images/shopping_basket.png" width="21" height="18" alt="Shopping Basket icon" /> cart</a></li>
        <li class="welcome">|</li>
     
 
					<li class="register"><a href="logout.asp">SIGN-OUT</a></li>
								
			
			
			
        
        </ul>
      </div>
    </div>
    <!-- / header bar -->
    
    <!-- topmenu -->
    <div id="topmenu">
      <div class="topmenu_container">
        <ul>
			
    
			<li><a href="register.asp?myProfile=True">My Profile</a></li>
    
		
			
				<li><a href="#">Manage Businesses</a></li>
				<li><a href="vouch-entry-list.asp">Vouchers</a></li>
			
			
    
    		<li><a href="changeBar.asp?newBar=F">Home</a></li>
    	    
    
        </ul>
      </div>
    </div>
    <!-- / topmenu -->
 
 
 
    <!-- main body -->
    <div id="middle">
    
      <!-- featured deal -->
     <div class="featured_deal_top"></div>
      <div class="featured_deal">
        <div class="featured_deal_bg">
          <div class="generic_container">
 
        					
 
	
	<h2> <center> Voucher Details </center> </h2>
		
<div class="VoucherEntryDetails">
	
	<form id="frm" method="post" name="frm" action="register.asp?mode=save&myProfile=False&origPage=home.asp">
 
         <div class="entry_details_form">
         			     
 
        <table class="entry_form" width="100%" border="0">
 
        <tr>
 
         
 
        <td width="51%">Name of Deal <span class="required">*</span><br />
 
		<input name="txtDeal" type="text" class="input_item" value="$17 for a hop-on hop-off Toronto city tour ticket (a $39.50 value)" maxlength="100" /></td>
		
        <td width="49%">Applicable City <span class="required">*</span><br />
        
				<input type="hidden" id="hidCity" name="hidCity" value="1">
				
				<select name="cboCity" id="cboCity">
        		<option value="0">*** Select a City ***</option>
 
			<option value="1">Toronto</option>
			
 
 
                </select>
         </td>			
 
        </tr>
 
        
 
        <tr>
 
        <td>Type of Deal <span class="required">*</span><br />
				
				<input type="hidden" id="hidType" name="hidType" value="F">
				<select name="cboType" id="cboType" onChange="expiryShowHide();">
        		<option value="R"> Regular</option>
                <option value="F"> Featured</option>
                </select></td>
 
        
 
    	<td valign="bottom">
 
			<div id="divFeatExpire" name="divFeatExpire" style="display: block;"> 
			
				Feature Deal can be bought until<br />
				
    			<input name="txtFeatExpiry" type="text" class="input_item" maxlength="12" value="11-01-2011" readonly="readonly" />
				<span class="cal_img"><img src="images/calendar_img.png" alt="calendar icon" width="27" height="27" align="absbottom" /></span>
        
			</div>
        </td>
        </tr>
		
        
        <tr>
          <td valign="middle">Company: </b> City Sightseeing Toronto <b> <br />
			<input name="btnChangeBusiness" type="button" class="voucher_entry_buttonChange" /></td>
 
    	<td valign="bottom">Deal Expiry<br />
 
    	<input name="txtDealExpiry" type="text" class="input_item" maxlength="12" value="03-15-2011" readonly="readonly" />
        <span class="cal_img"><img src="images/calendar_img.png" alt="calendar icon" width="27" height="27" align="absbottom" /></span></td>
        </tr>
        
        
 
        <tr>
 
        <td>Short Description<br />
          <textarea name="txtShortDesc" cols="200" rows="4" class="input_item">A 7-day hop-on, hop-off tour that includes a boat tour of the Toronto harbour and islands. Tour includes 28 amazing stops, free downtown pickup, fun friendly guides, and guests receive a free souvenir</textarea>
	          <p class="description_text">This description is intended for a short introductory of the deal.  Maximum 200 characters</p>
         </td>
 
        
        <td>Long Description<br />
          <textarea name="txtLongDesc" cols="300" rows="7" class="input_item">"Not to be overly sceptical of the intermittent civic history rants you receive from dear old dad while you ride shotgun on the way to the orthopediatrician, but wouldn't it be grand if you actually got to go on a guided, professional tour of Toronto without seeing it through the lens of an old Buick's roll-down window? If you are presently nodding your head to the computer screen then please proceed with today¿s great deal: $17 for a 1-person, 3-day, hop-on, hop-off double-decker bus tour and Toronto harbour & island boat cruise from City Sightseeing Toronto ($39.50 Value)
 
If there's one thing to thank the British for ¿besides the host of all their other international contributions¿it's the unique creation of the Double-Decker bus. No guided tour is official without one, and City Sightseeing Toronto is as official as it gets with their convenient hop-on/hop-off method that allows you to choose the particular location sites that entice you, hop-off for a spell and peruse with your camera finger or credit card on the ready, then hop back on at any of their designated pick up times or spots. But wait, there's more. Not only will you get to tour our beloved city's land-based history, but you'll also get to cruise the harbour and its 14 islands aboard the only boat in Toronto to offer a 360-degree view from it's upper deck. Toronto will never appear more beautiful.
 
There's nothing like taking a day off to learn some interesting and informative facts about the city you're visiting, or the city you've recently moved to, or the city that's raised you from a wee lad or lass. City Sightseeing Toronto is an enjoyable experience and fun for people of all ages, so even you know-it-all types are sure to pick up a thing or two¿or three, or four, or five...  Enjoy.
 
 
"</textarea>
                   <p class="description_text">This description is intended to describe the deal in full detail.</p>
         </td>
        </tr>
 
        
 
        
 
        <tr>
		  <td>PDF Description <span class="required">*</span><br />
          <textarea name="txtPDFDesc" cols="100" rows="4" class="input_item">$39.50 Voucher hop-on hop-off Toronto city tour ticke</textarea>
			         <p class="description_text">This description will be printed on the actual voucher at the time of purchase. Maximum 100 characters</p>
 
                <td></td>
        </tr>
 
 
 
	<tr>
	<td>Face Value $  <span class="required">*</span><br />
	<input name="txtFaceValue" type="text" class="input_item" value="39.50" maxlength="100" /></td>
	 
	<td>Maximum Vouchers to be Sold <span class="required">*</span><br />
	<input name="txtMax" type="text" class="input_item" value="100" maxlength="100" /></td>
	</tr>
		
	    
	    <tr>
	    <td>Sale Value $  <span class="required">*</span><br />
	<input name="txtSaleValue" type="text" class="input_item" value="17.00" maxlength="100" /></td>
	    
	     
    <td>Redeemable at<br /><br />
    
          <input name="chkLoc1" id="chkLoc1" type="checkbox" value="chkLoc1Yes" onClick="locPopulate(1);" CHECKED> Location 1<br />
        
				<input type="hidden" id="hidLLoc1" name="hidLoc1" value="Waterfront Info Centre /n 114-249 Queen's Quay West /n Toronto, Ontario M5R-1H4 /n on the east side of the Radisson Admiral Hotel">
				<textarea name="txtLoc1" id="txtLoc1" cols="200" rows="2" class="input_item"> Waterfront Info Centre
114-249 Queen's Quay West
Toronto, Ontario M5R-1H4
on the east side of the Radisson Admiral Hotel </textarea><br /><br /><br />
 
          <input name="chkLoc2" id="chkLoc2" type="checkbox" value="chkLoc2Yes" onClick="locPopulate(2);" CHECKED> Location 2<br />
        
				<input type="hidden" id="hidLLoc2" name="hidLoc2" value="Downtown Info Centre /n 1 Dundas Street East /n Toronto, Ontario /n look for the silver kiosk in the square, across the street from the Hard Rock Café">
				<textarea name="txtLoc2" id="txtLoc2" cols="200" rows="2" class="input_item"> Downtown Info Centre
1 Dundas Street East
Toronto, Ontario
look for the silver kiosk in the square, across the street from the Hard Rock Café </textarea><br /><br /><br />
 
          
          <input name="chkLoc3" id="chkLoc3" type="checkbox" value="chkLoc3Yes" onClick="locPopulate(3);" CHECKED> Location 3<br />
        
				<input type="hidden" id="hidLLoc3" name="hidLoc3" value="Union Station Info Centre /n 65 Front Street East /n Toronto, Ontario /n inside the Great Hall between the Lotto Centre and the Go Transit ticket booths">
				<textarea name="txtLoc3" id="txtLoc3" cols="200" rows="2" class="input_item"> Union Station Info Centre
65 Front Street East 
Toronto, Ontario 
 
inside the Great Hall between the Lotto Centre and the Go Transit ticket booths </textarea><br /><br /><br />
 
	</td>
 
			<tr>
			<td>
			Restrictions<br />
			<textarea name="txtRestrict" cols="500" rows="4" class="input_item"> Voucher must be redeemed for a ticket prior to use. Tickets are non-transferable and valid for up to 72 hours. Tickets are non-transferable and not valid with other others. </textarea>
			<p class="description_text">Do not include voucher's Expiry Date here, as it will be automatically included, where applicable</p>
			</td>
			 
 
			<td>Universal Restrictions<br />
			<textarea name="txtUnivRestrict" cols="500" rows="4" class="input_item"> Not valid for cash back (unless required by law). Must use in one visit. Doesn't cover tax or gratuity. Can't be combined with other offers. </textarea></td>
			</tr>
			 
			<tr>
			<td> Voucher Image 1 <input type="file" name="txtIMG1" class="file" /> <font color='#010066'> Previously Uploaded... </font><br /><br />
			 
			 
			Voucher Image 2 <input type="file" name="txtIMG2" class="file" /> <font color='#010066'> Previously Uploaded... </font><br /><br />
			 
			 
			Voucher Image 3 <input type="file" name="txtIMG3" class="file" /> <font color='#010066'> Previously Uploaded... </font>
			<br /><br /><span class="notes"> 
				If "Previously Uploaded..." is noted above, an image has been uploaded in a previous session, Click Browse... to replace image.
				*.jpg or *.gif formats only, upto 100K.  Busines Logos should be uploaded<br />
				through the busines profile</span>
			</td>
			 
			<td><input name="chkDisable" type="checkbox" value="Archived" > Disable Voucher<br />
			<br />
			<span class="notes">Checking this option will hide this voucher from the website,<br />
			preventing potential buyers fromn seeing and buying it.</span></td>
			</tr>
			 
			 </table> 
 
							
 
						
 
				<ul>
				<li class="submit">
				<input name="btnSubmit" type="submit" value="" class="preview_changes">
				<input name="btnCancel" type="button" value="" class="cancel_changes"></li>
				</ul>
 
				</div>																	
 
			</form>
 
			</div>
 
		  </div>
 
		</div>
 
	
 
 
		  </div>
		</div>
      </div>
      <!-- / featured deal -->
           
    
    </div>
    <!-- / main body -->
 
  
 
 
  </div>
</div>
<!-- post header -->
 
</div>
 
<!-- footer -->
<div id="footer">
  <div class="rapidxwpr">
  
    <!-- footer links -->
    <div class="footer_links">
    
      <div class="learnmore">
        <h3>LEarn MOre</h3>
        <ul>
          <li><a href="faq.asp">FAQ</a></li>
          <li><a href="how-it-works.asp">How It Works</a></li>
          <li><a href="contact.asp">Contact / Feedback</a></li>
          <li><a href="">Refer a Friend</a></li>
        </ul>
      </div>
      
      <div class="company">
        <h3>company</h3>
        <ul>
          <li><a href="">About Us</a></li>
          <li><a href="terms.asp">Terms</a></li>
          <li><a href="privacy.asp">Privacy</a></li>
        </ul>
      </div>
      
      <div class="company">
        <h3>business</h3>
        <ul>
          <li><a href="">Suggest a Business</a></li>
          <li><a href="">Get Your Business Featured</a></li>
        </ul>
      </div>
      
      <div class="followus">
        <h3>follow us</h3>
        <ul>
          <li><a href="">Facebook</a></li>
          <li><a href="">Twitter</a></li>
          <li><a href="">Get Daily Deal Alert emails!</a></li>
        </ul>
      </div>
    
    </div>
    <!-- / footer links -->
    
    <!-- copyright -->
    <div class="copyright">
      <span class="copyright">&copy; 2010 mylocaladvantage.com.<br /> All rights reserved.</span>
    </div>
    <!-- / copyright -->
 
  
  <!-- creadit/verfication/hosting info -->
    <div class="creditcards">
     <!--img src="images/siteseal_gd_3_h_d_m.gif" width="132" height="31" alt="Godaddy Verification Seal" /-->
     
     <span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal?sealID=2kLJWyprOXYBtu2hgDXfGNE7oxNjXV4TWKw2VZLHn4MWu2JkVPElAR3algg"></script><br/><a style="font-family: arial; font-size: 9px" href="http://www.godaddy.com/ssl/ssl-certificates.aspx" target="_blank">SSL Cert</a></span>
    	 <br />
    	 <br />
	<img src="images/credit-cards-logos.png" width="150" height="34" alt="Acceptable Creadit Cards" />
    	<br />
	Hosted by <a href="#">APD</a>    
    </div>
  <!-- / creadit/verfication/hosting info -->
  
   
  
  </div>
</div>
<!-- / footer -->
 
</body>
</html>
 
 
 
<script type="text/javascript"> 
 
function pageLoad(){
	
	fillCBO("cboCity", "hidCity");
	fillCBO("cboType", "hidType");
	expiryShowHide();
}
 
function fillCBO(cboControl, txtControl)
	{
		var ddl = document.getElementById(cboControl);
                         
		for (i=0;i<ddl.options.length;i++)
		{
			if (ddl.options[i].value==document.getElementById(txtControl).value)
		     {
		         ddl.selectedIndex=i;
		        return;
		      }
		}
	}
	
function expiryShowHide()
{
	var vType = document.getElementById("cboType").value;
	
	if (vType == 'R')
	{
		document.getElementById("divFeatExpire").style.display = 'none';
	}
	else
	{
		document.getElementById("divFeatExpire").style.display = 'block';
	}
}
 
function locPopulate(locID)
{
	var chk = document.getElementById("chkLoc" + locID).checked;
	var loc = document.getElementById("hidLoc" + locID).value;
	
	if (chk == true)
	{	
		document.getElementById("txtLoc" + locID).value = loc;
	}
	else
	{	
		document.getElementById("txtLoc" + locID).value = '';
	}
}
 
</script>

Open in new window

0
Comment
Question by:APD_Toronto
2 Comments
 
LVL 3

Accepted Solution

by:
Mel_Pemble earned 500 total points
ID: 35054278

You are using getElementById
"ID"

var loc = document.getElementById("hidLoc" + locID).value;

Yet your hidden input has an "id" of hidLLoc1
2 L's

<input type="hidden" id="hidLLoc1" name="hidLoc1" value="Waterfront Info Centre /n 114-249 Queen's Quay West /n Toronto, Ontario M5R-1H4 /n on the east side of the Radisson Admiral Hotel">

so Either change the javascript to look at the correct id,  or change the input to match what the javascript is looking for
0
 

Author Closing Comment

by:APD_Toronto
ID: 35058363
thank you.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now