?
Solved

Object expected

Posted on 2003-03-25
13
Medium Priority
?
283 Views
Last Modified: 2011-09-20
Hi everyone,

Ths following code segment outputs multiple lines each beginning with "Expand". When you click on the "Expand" link, it expands/collapses a DIV section containing further text. Ultimately, you would have 4 lines such as this that could all be expanded/collapsed in such a manner. The code works in that the appropriate section will expand/collapse, but for some reason, I continue to get a javascript error stating "Object Expected" and I don't know why. Any help would be greatly appreciated. Thanks.

<script language="JavaScript">
function showDivSection(div) {
   div.style.display='';
}
               
function hideDivSections(div) {
   div.style.display='none';
}
                         
function ExpandCollapse(div) {
   if (div.style.display == '') {
      hideDivSections(div);
}
else if (div.style.display == 'none'){
   showDivSection(div);
   }
}              
</script>    

<xsl:param name="position"><xsl:value-of select="position()"/></xsl:param>
         
<tr class="title">
  <td colspan="1">
  <a href="javascript:doNothing()">
    <xsl:attribute name="onClick">ExpandCollapse(document.getElementById('<xsl:value-of select="xalan:evaluate($position)"/>'));</xsl:attribute>
  Expand
  </a>
  Locale Information (<xsl:value-of select="om:Name"/>)
  </td>
  <td>
    <input type="checkbox">Host input complete</input>
  </td>
</tr>
<tr>
  <td>
    <div>
      <xsl:attribute name="id"><xsl:value-of select="xalan:evaluate($position)"/></xsl:attribute>    
      <xsl:call-template name="LM"/>
      <br/>                                  
    </div>
  </td>
</tr>
0
Comment
Question by:SquishyD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +2
13 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 8206223
Are you wanting to just expand/collaspe a <div>?
0
 

Author Comment

by:SquishyD
ID: 8206251
Yes that's right.
0
 

Author Comment

by:SquishyD
ID: 8206259
Yes that's right.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:SquishyD
ID: 8206260
Yes that's right.
0
 

Author Comment

by:SquishyD
ID: 8206271
Sorry for the multiple posts. Did not mean that. I am dynamically assigning DIV Id's here.
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 75 total points
ID: 8206342
Try this. It isn't xsl but...

It is an example i had in my ''tool box''

<html>
<head>
<title>Table Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="Javascript">
<!--
function render(c, t) {
if (c.checked) {
 document.getElementById(t).style.display="block"
} else {
 document.getElementById(t).style.display="none"
}
}
//-->
</script>

</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="29%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="16">
      <input type="checkbox" name="checkbox" value="checkbox" onClick="render(this, 'tblTest1')">
      Q: How Do I Blah Blah Blah</td>
  </tr>
</table>
<table id="tblTest1" style="display:none" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td>
      <blockquote>
        <p>A: BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHBLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH </p>
        </blockquote>
    </td>
  </tr>
</table>
<table width="30%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <input type="checkbox" name="checkbox2" value="checkbox" onClick="render(this, 'tblTest2')">
      Q: How Do I Blah Blah Blah</td>
  </tr>
</table>
<table id="tblTest2" style="display:none" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td><blockquote>
        <p>A: BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHBLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH </p>
        </blockquote></td>
  </tr>
</table>
<table width="30%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <input type="checkbox" name="checkbox22" value="checkbox" onClick="render(this, 'tblTest3')">
      Q: How Do I Blah Blah Blah</td>
  </tr>
</table>
<table id="tblTest3" style="display:none" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td><blockquote>
        <p>A: BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHBLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH </p>
        </blockquote> </td>
  </tr>
</table>
<table width="30%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <input type="checkbox" name="checkbox222" value="checkbox" onClick="render(this, 'tblTest4')">
      Q: How Do I Blah Blah Blah</td>
  </tr>
</table>
<table id="tblTest4" style="display:none" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td><blockquote>
        <p>A: BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHBLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH </p>
        </blockquote> </td>
  </tr>
</table>
<table width="30%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <input type="checkbox" name="checkbox2222" value="checkbox" onClick="render(this, 'tblTest5')">
      Q: How Do I Blah Blah Blah</td>
  </tr>
</table>
<table id="tblTest5" style="display:none" width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC">
  <tr>
    <td><blockquote>
        <p>A: BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHBLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH
          BLAH BLAH BLAH BLAH BLAH </p>
        </blockquote></td>
  </tr>
</table>
</body>
</html>
0
 
LVL 5

Expert Comment

by:kasandra
ID: 8207704
Which line is giving you the "object expected" error?
0
 

Author Comment

by:SquishyD
ID: 8207726
Argh I found it. It's the line that states:
<a href="javascript:doNothing()">
That stupid method was moved on me! Anyways thanks everyone.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9115285
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 5

Expert Comment

by:kasandra
ID: 9119061
Looks like SquishyD solved it himself... did any of the  questions / comments from experts help you SquishyD?
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9122128
agree with kasandra ;)
0
 
LVL 5

Expert Comment

by:kasandra
ID: 9126612
thanks jay ;)
0
 
LVL 6

Expert Comment

by:Programming_Gal
ID: 9656043
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept jaysolomon's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Programming_Gal
EE Cleanup Volunteer
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

770 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