473,498 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ERROR: object required.can u help me?

2 New Member
i have a js code which displays two html div on a click event.code is like this.

Expand|Select|Wrap|Line Numbers
  1.   function display()
  2. {
  3.     document.getElementById('headingtd1').bgColor="#EFEBEF";
  4.     document.getElementById('headingtd1').border = "2px solid #EFEBEF";
  5.     document.getElementById('values0').style.display="none";
  6.     document.getElementById('values2').style.display="none";
  7.     document.getElementById('values1').style.dislay="block";
  8.  
  9.        return true;
  10. }
  11.  
  12. function select_div(parmtr)
  13.     {       // -----------LINE 31--------------
  14.      for(var p=0; p<3; p++)
  15.         {
  16.         document.getElementById('values'+p).style.display = "none";
  17.         document.getElementById('headingtd'+p).bgColor="#FFFFFF";
  18.         document.getElementById('headingtd'+p).border ='0';
  19.      }
  20.     document.getElementById('values'+parmtr).style.display = 'block';
  21.     document.getElementById('headingtd'+parmtr).bgColor='#EFEBEF';
  22.     document.getElementById('headingtd'+parmtr).border = '2px solid #EFEBEF';
  23.     return true;
  24. }
  25.  
here i hav 3 div values0,values1 and values2 also headingtd0,headingtd1 and headingtd2 are 3 table-td id's .function display is calling in pageload event and select_div in a click event. here my problem is getting an error in page load which says that "Line:31 char:9 Object required". line 31 is the opening of the for loop.
Oct 9 '07 #1
3 1761
gits
5,390 Recognized Expert Moderator Expert
hi ...

welcome to TSDN ...

could you please post the related html too? so that we may have a closer look at it?

kind regards
Oct 9 '07 #2
maartha
2 New Member
ya sure.............

Expand|Select|Wrap|Line Numbers
  1. function display()
  2. {
  3.     document.getElementById('headingtd1').bgColor="#EFEBEF";
  4.     document.getElementById('headingtd1').border = "2px solid #EFEBEF";
  5.     document.getElementById('values0').style.display="none";
  6.     document.getElementById('values2').style.display="none";
  7.     document.getElementById('values1').style.dislay="block";
  8.  
  9.     return true;
  10. }
  11.  
  12. function select_div(parmtr)
  13.     {       // -----------LINE 31--------------
  14.      for(var p=0; p<3; p++)
  15.         {
  16.         document.getElementById('values'+p).style.display = "none";
  17.         document.getElementById('headingtd'+p).bgColor="#FFFFFF";
  18.         document.getElementById('headingtd'+p).border ='0';
  19.     }
  20.     document.getElementById('values'+parmtr).style.dis  play = 'block';
  21.     document.getElementById('headingtd'+parmtr).bgColo  r='#EFEBEF';
  22.     document.getElementById('headingtd'+parmtr).border   = '2px solid #EFEBEF';
  23.     return true;
  24. }

//---------------------html---------------------------------------------------------------

[HTML]<table>
<tr>
<td id="headingtd0" nowrap align=center style="border:0px solid ; width:150; "><a class=browseby href="/" onclick="select_div(0); return false" >Keywords</a></td>
<td>&nbsp;</td>

<td id="headingtd1" nowrap align=center style="border:0px solid ; width:150;"><a class=browseby href="/" onclick="select_div(1); return false;">Locations</a></td>
<td>&nbsp;</td>

<td id="headingtd2" nowrap align=center style="border:0px solid ; width:150;"><a class=browseby href="/" onclick="select_div(2); return false;">Company</a></td>

</table>
</tr>

<div id="values0">
<table border="0" cellpadding="5" cellSpacing="0" width="700">
<tr>
<td></td>
</tr>
</table>
</div>


<div id="values1">
<table border="0" cellpadding="5" cellSpacing="0" width="700">
<tr>
<td></td>
</tr>
</table>

</div>
</center>

<div id="values2">
<table border="0" cellpadding="5" cellSpacing="0" width="700">
<tr>
<td></td>
</tr>
</table>

</div>[/HTML]





here i hav 3 div values0,values1 and values2 also headingtd0,headingtd1 and headingtd2 are 3 table-td id's .function display is calling in pageload event and select_div in a click event. here my problem is getting an error in page load which says that "Line:31 char:9 Object required". line 31 is the opening of the for loop.
Oct 9 '07 #3
gits
5,390 Recognized Expert Moderator Expert
hi ...

the following setup works ... i only fixed the wrong placed </tr> of your first table:

[HTML]
<script type="text/javascript">
function display()
{
document.getElementById('headingtd1').bgColor="#EF EBEF";
document.getElementById('headingtd1').border = "2px solid #EFEBEF";
document.getElementById('values0').style.display=" none";
document.getElementById('values2').style.display=" none";
document.getElementById('values1').style.dislay="b lock";

return true;
}

function select_div(parmtr)
{ // -----------LINE 31--------------
for(var p=0; p<3; p++)
{
document.getElementById('values'+p).style.display = "none";
document.getElementById('headingtd'+p).bgColor="#F FFFFF";
document.getElementById('headingtd'+p).border ='0';
}
document.getElementById('values'+parmtr).style.dis play = 'block';
document.getElementById('headingtd'+parmtr).bgColo r='#EFEBEF';
document.getElementById('headingtd'+parmtr).border = '2px solid #EFEBEF';
return true;
}
</script>

<body onload="display();">
<table>
<tr>
<td id="headingtd0" nowrap align=center style="border:0px solid ; width:150; ">
<a class=browseby href="/" onclick="select_div(0); return false" >Keywords</a>
</td>
<td>&nbsp;</td>
<td id="headingtd1" nowrap align=center style="border:0px solid ; width:150;">
<a class=browseby href="/" onclick="select_div(1); return false;">Locations</a>
</td>
<td>&nbsp;</td>
<td id="headingtd2" nowrap align=center style="border:0px solid ; width:150;">
<a class=browseby href="/" onclick="select_div(2); return false;">Company</a>
</td>
</tr>
</table>

<div id="values0">
<table border="0" cellpadding="5" cellSpacing="0" width="700">
<tr>
<td>test</td>
</tr>
</table>
</div>
<div id="values1">
<table border="0" cellpadding="5" cellSpacing="0" width="700">
<tr>
<td>test2</td>
</tr>
</table>
</div>
<div id="values2">
<table border="0" cellpadding="5" cellSpacing="0" width="700">
<tr>
<td>test3</td>
</tr>
</table>
</div>
</body>
[/HTML]
so i cannot find another error? ... which browser do you use?

kind regards
Oct 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2703
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the...
0
1568
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
9
1642
by: Remulac | last post by:
Hello, I'm trying to get the value out of a dropdown list box and assign it to a variable. When I click on the list box, I invoke this line of code. I get the error, "Object reference not set...
3
2420
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
8
2455
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!!...
0
23441
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
7
3577
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
2
19391
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
7749
by: santoshsri | last post by:
Hi All, My C# web application calls a webservice to process a report. It sends XMLs as parameter and in response gets an XML node which stores Binay datatype bin.base64. It makes an instance of...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.