[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Object Expected error

Posted on 2009-12-21
7
Medium Priority
?
327 Views
Last Modified: 2012-05-08
I'm getting an Object Expected error on line 220 in my code and I can't figure out why... Am I doing my button wrong somehow?
<!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" xml:lang="en" lang="en">
<head>
  <title>White Glove Preday Check Email Generator</title>
 
 <script language="javascript" type="text/javascript">
 
 Function asia() {
 
  if (document.Backups.value == "Green")
 	{alert ("Yo!")}
	;
	
 }
 </script>
 
</head>
<body>
<center><b>White Glove Preday Check Email Generator</b></Center>
<br><p>
<table border="1">
  <tr><!-- Row 1 -->
     <td>Antrim/Zavacor</td><!-- Col 1 -->
     <td><select name="Ant_Zav" onChange="document.getElementById('Ant_Zav_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="Ant_Zav_Explain" style="display: none">
		Explanation: <input type="textbox" name="Ant_Zav_Explained" size="32"/>
		</div>
	</td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 2 -->
     <td>Backups</td><!-- Col 1 -->
     <td><select name="Backups" onChange="document.getElementById('Backups_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="Backups_Explain" style="display: none">
		Explanation: <input type="textbox" name="Backups_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 3 -->
     <td>Data Extract/Loader</td><!-- Col 1 -->
     <td><select name="DEL" onChange="document.getElementById('DEL_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="DEL_Explain" style="display: none">
		Explanation: <input type="textbox" name="DEL_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 4 -->
     <td>Data Transfer</td><!-- Col 1 -->
     <td><select name="DT4" onChange="document.getElementById('DT4_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="DT4_Explain" style="display: none">
		Explanation: <input type="textbox" name="DT4_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 5 -->
     <td>Database - DSM</td><!-- Col 1 -->
     <td><select name="DSM" onChange="document.getElementById('DSM_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="DSM_Explain" style="display: none">
		Explanation: <input type="textbox" name="DSM_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 6 -->
     <td>Database - Informix</td><!-- Col 1 -->
     <td><select name="INF" onChange="document.getElementById('INF_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="INF_Explain" style="display: none">
		Explanation: <input type="textbox" name="INF_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 7 -->
     <td>Database - Oracle</td><!-- Col 1 -->
     <td><select name="ORA" onChange="document.getElementById('ORA_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="ORA_Explain" style="display: none">
		Explanation: <input type="textbox" name="ORA_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 8 -->
     <td>FLR/Exacta</td><!-- Col 1 -->
     <td><select name="FLR" onChange="document.getElementById('FLR_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="FLR_Explain" style="display: none">
		Explanation: <input type="textbox" name="FLR_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 9 -->
     <td>LabLink</td><!-- Col 1 -->
     <td><select name="LAB" onChange="document.getElementById('LAB_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="LAB_Explain" style="display: none">
		Explanation: <input type="textbox" name="LAB_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 10 -->
     <td>Network</td><!-- Col 1 -->
     <td><select name="NET" onChange="document.getElementById('NET_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="NET_Explain" style="display: none">
		Explanation: <input type="textbox" name="NET_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 11 -->
     <td>QBS</td><!-- Col 1 -->
     <td><select name="QBS" onChange="document.getElementById('QBS_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="QBS_Explain" style="display: none">
		Explanation: <input type="textbox" name="QBS_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 12 -->
     <td>Server - INTEL</td><!-- Col 1 -->
     <td><select name="INTEL" onChange="document.getElementById('INTEL_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="INTEL_Explain" style="display: none">
		Explanation: <input type="textbox" name="INTEL_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 13 -->
     <td>Unix Servers</td><!-- Col 1 -->
     <td><select name="UNI" onChange="document.getElementById('UNI_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="UNI_Explain" style="display: none">
		Explanation: <input type="textbox" name="UNI_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 14 -->
     <td>Storage</td><!-- Col 1 -->
     <td><select name="STO" onChange="document.getElementById('STO_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="STO_Explain" style="display: none">
		Explanation: <input type="textbox" name="STO_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
</table>
<input type="button" value="press me" onClick="javascript:asia()"/>
</body>
</html>

Open in new window

0
Comment
Question by:Awake_in_naptown
7 Comments
 
LVL 6

Accepted Solution

by:
jello024 earned 1000 total points
ID: 26100802
Function asia()  
should be:
function asia()
0
 
LVL 12

Assisted Solution

by:jazzIIIlove
jazzIIIlove earned 1000 total points
ID: 26100846
document.Backups.value is empty. Check for it.
0
 
LVL 4

Expert Comment

by:TMarkham1
ID: 26100850
You may even need to go further than that... try replacing the whole asia function code with this:

function asia() {
   if (document.Backups.value == "Green")
   { 
      alert ("Yo!");
   }
 }

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:TMarkham1
ID: 26100952
Actually, I modified your HTML even further. I added an ID attribute to the Backups element, and modified the asia function as well. It works for me. Give it a shot.


<!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" xml:lang="en" lang="en">
<head>
  <title>White Glove Preday Check Email Generator</title>
 
 <script language="javascript" type="text/javascript">
 
 function asia() {
 
  var sel = document.getElementById("Backups");
  if (sel.options[sel.selectedIndex].value == "Green")
     {
       alert("Yo!");
     }
	
 }
 </script>
 
</head>
<body>
<center><b>White Glove Preday Check Email Generator</b></Center>
<br><p>
<table border="1">
  <tr><!-- Row 1 -->
     <td>Antrim/Zavacor</td><!-- Col 1 -->
     <td><select name="Ant_Zav" onChange="document.getElementById('Ant_Zav_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="Ant_Zav_Explain" style="display: none">
		Explanation: <input type="textbox" name="Ant_Zav_Explained" size="32"/>
		</div>
	</td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 2 -->
     <td>Backups</td><!-- Col 1 -->
     <td><select id="Backups" name="Backups" onChange="document.getElementById('Backups_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="Backups_Explain" style="display: none">
		Explanation: <input type="textbox" name="Backups_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 3 -->
     <td>Data Extract/Loader</td><!-- Col 1 -->
     <td><select name="DEL" onChange="document.getElementById('DEL_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="DEL_Explain" style="display: none">
		Explanation: <input type="textbox" name="DEL_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 4 -->
     <td>Data Transfer</td><!-- Col 1 -->
     <td><select name="DT4" onChange="document.getElementById('DT4_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="DT4_Explain" style="display: none">
		Explanation: <input type="textbox" name="DT4_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 5 -->
     <td>Database - DSM</td><!-- Col 1 -->
     <td><select name="DSM" onChange="document.getElementById('DSM_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="DSM_Explain" style="display: none">
		Explanation: <input type="textbox" name="DSM_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 6 -->
     <td>Database - Informix</td><!-- Col 1 -->
     <td><select name="INF" onChange="document.getElementById('INF_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="INF_Explain" style="display: none">
		Explanation: <input type="textbox" name="INF_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 7 -->
     <td>Database - Oracle</td><!-- Col 1 -->
     <td><select name="ORA" onChange="document.getElementById('ORA_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="ORA_Explain" style="display: none">
		Explanation: <input type="textbox" name="ORA_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 8 -->
     <td>FLR/Exacta</td><!-- Col 1 -->
     <td><select name="FLR" onChange="document.getElementById('FLR_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="FLR_Explain" style="display: none">
		Explanation: <input type="textbox" name="FLR_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 9 -->
     <td>LabLink</td><!-- Col 1 -->
     <td><select name="LAB" onChange="document.getElementById('LAB_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="LAB_Explain" style="display: none">
		Explanation: <input type="textbox" name="LAB_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 10 -->
     <td>Network</td><!-- Col 1 -->
     <td><select name="NET" onChange="document.getElementById('NET_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="NET_Explain" style="display: none">
		Explanation: <input type="textbox" name="NET_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 11 -->
     <td>QBS</td><!-- Col 1 -->
     <td><select name="QBS" onChange="document.getElementById('QBS_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="QBS_Explain" style="display: none">
		Explanation: <input type="textbox" name="QBS_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 12 -->
     <td>Server - INTEL</td><!-- Col 1 -->
     <td><select name="INTEL" onChange="document.getElementById('INTEL_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="INTEL_Explain" style="display: none">
		Explanation: <input type="textbox" name="INTEL_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 13 -->
     <td>Unix Servers</td><!-- Col 1 -->
     <td><select name="UNI" onChange="document.getElementById('UNI_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="UNI_Explain" style="display: none">
		Explanation: <input type="textbox" name="UNI_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
  <tr><!-- Row 14 -->
     <td>Storage</td><!-- Col 1 -->
     <td><select name="STO" onChange="document.getElementById('STO_Explain').style.display=this.options[this.selectedIndex].value!='Green'?'':'none'">
				  <option selected value="Green">Green</option>
				  <option value="Green*">Green*</option>
				  <option value="Yellow">Yellow</option>
				  <option value="Yellow*">Yellow*</option>
				  <option value="Red">Red</option>
				  <option value="Red*">Red*</option>
				  </select>
		<div id="STO_Explain" style="display: none">
		Explanation: <input type="textbox" name="STO_Explained" size="32"/>
		</div></td><!-- Col 2 -->
  </tr>
</table>
<input type="button" value="press me" onClick="javascript:asia()"/>
</body>
</html>

Open in new window

0
 
LVL 1

Author Closing Comment

by:Awake_in_naptown
ID: 31668785
Essentially, yes it was that I used a capital F instead of a lowercase. Did a little fidgiting with the code and found that I needed a little more to it. Thanks guys, it's working now.
0
 
LVL 1

Author Comment

by:Awake_in_naptown
ID: 26100988
TMarkham1:

Well done with that code, it does make it a lot simpler. What i ended up doing was nesting the whole thing inside of a form, which was going to be the end result anyway. If I could  give you some points now I totally would! Sorry I missed your additions, you added them right as I was handing out the points :/
0
 
LVL 4

Expert Comment

by:TMarkham1
ID: 26101092
No problem on the points... I just simplified the original true solutions anyhow. They right guys got the point I think.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

867 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