471,873 Members | 1,030 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

error message "object required"

110 100+
On a webpage that has a variety of questions I get an "object required" error on lines like this...

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('tableQuestion17').style.visibility="visible";
This is the code for the table "tableQuestion17"

Expand|Select|Wrap|Line Numbers
  1. <table border="0" width="100%" id="tableQuestion17" cellpadding="0" style="visibility:hidden">
  2.             <tr>
  3.                   <td bgcolor="#003300" style="padding-right: 5px" width="55%">
  4.                   <p align="right"><b>
  5.                   <font color="#FFFFFF" size="2" face="Arial Narrow">Specify 
  6.                   other method:</font></b></td>
  7.                   <td width="45%" style="border: 1px solid #003300; padding-left: 3px; padding-top: 3px; padding-bottom: 3px">
  8.                  <input type="text" name="otherMethod" id="otherMethod" onChange="javascript:question('17')" size="60" style="border: 1px solid #003300; font-family:Arial Narrow; font-size:10pt; color:#000080;" tabindex="-1" ></td>
  9.                 </tr>
  10.           </table>
I really don't get it. Why does javascript not accept this object?
Jan 12 '09 #1
10 7373
16,027 Expert Mod 8TB
Where does this line get called?
Jan 12 '09 #2
110 100+
Jan 12 '09 #3
16,027 Expert Mod 8TB
OK, can you post the question() function code.
Jan 12 '09 #4
110 100+
The entire function is over 1200 lines; and, I know you don't really want that, here is the portion in question

Expand|Select|Wrap|Line Numbers
  1. function question(x){
  3.  if(x=="17"){// describe the 'other' method
  4.    document.getElementById('tableCompletionFeedback').background="../Images/completionBLUE51%25.jpg";
  5.    document.getElementById('percent').style.fontFamily="Arial Narrow"; 
  6.    document.getElementById('percent').style.fontSize="10pt";
  7.    document.getElementById('percent').align="right";
  8.    document.getElementById('percent').innerHTML="51% complete"; 
  9.    document.getElementById('tableQuestion18').swapNode(document.getElementById('tableRow3'));
  10.    document.getElementById('tableQuestion18').style.visibility="visible";
  11.    document.getElementById('tableQuestion18').id="item3";
  12.    document.getElementById('cellOutput17').style.fontFamily="Arial Narrow"; 
  13.    document.getElementById('cellOutput17').style.fontSize="10pt"; 
  14.    document.getElementById('cellOutput17').innerHTML="Valuation method is: "+rtrim(document.getElementById('otherMethod').value);
  15.    document.getElementById('coinsurance').focus();
  16.    }
  17. }
Jan 12 '09 #5
16,027 Expert Mod 8TB
There's no swapNode method. Have you added it via prototype?
Jan 12 '09 #6
110 100+
Trust me the problem is within the code I have already posted. But just for good measure, here's swapNode, which is a function I have used time and again.

Expand|Select|Wrap|Line Numbers
  1. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  2. <title>Vacant Buildings Submission Manager</title>
  3. <script type="text/javascript; version=1.5">
  4. Node.prototype.swapNode = function (node) {
  5.   var nextSibling = this.nextSibling;
  6.   var parentNode = this.parentNode;
  7.   node.parentNode.replaceChild(this, node);
  8.   parentNode.insertBefore(node, nextSibling);
  9.   }  
  10. </script>
Jan 13 '09 #7
110 100+
I should also mention that it displays the error message but it still performs the function as it is supposed to do.
Jan 13 '09 #8
16,027 Expert Mod 8TB
which does answer my question - you added it via prototype.

The error message makes me think it's in IE. Have you tried other browsers for something more useful?
Jan 14 '09 #9
110 100+
FireFox gets so bogged down with "object has no properties" messages that it crashes before it ever gets to this point. But, it has to work in IE. Our website tracking software says that every one of our clients uses IE.
Jan 14 '09 #10
16,027 Expert Mod 8TB
It can work in both, or more precisely, most (if not all) browsers with a little careful thinking to leave no-one out and avoid losing visitors.

Do you have a link? To pinpoint the problem, you need to find the exact lines and more useful error messages. IE is quite bad at line numbers. You may also find a debugger such as Firebug useful.
Jan 14 '09 #11

Post your reply

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

Similar topics

5 posts views Thread by DaFallus | last post: by
4 posts views Thread by Phil | last post: by

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.