473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

FF Error Console: "document.getElementById...has no properties"

Hey guys,
I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an iframe's src property. Being that IE does not follow standard and considers an id, name, etc as a qualifying identifier for the document.getElementById object, I double checked to make sure that there's only one instance of id = "servif" and I never use the name attribute anyhow, so don't worry about that. The odd thing is that when you initially execute the failing function it recognizes the iframe's id and adjusts the src appropriately, but when it executes the second time, it's almost as if the id 'servif' has expired and it no longer recognizes the object. The entire FF Error is "document.getElementById('servif') has no properties." Any ideas?

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2.                       "http://www.w3.org/TR/html4/strict.dtd">
  3.  
  4. <html>
  5. <head>
  6.  
  7. <script type="text/javascript">
  8. var menuDelay = 1;
  9. var menuSpeed = 1;
  10. var offx = parseInt((screen.availWidth - 633)/2);
  11. var roptab = 'closed';
  12. var loptab = 'closed';
  13. var intervlID;
  14.  
  15. function adjust() {
  16. if (navigator.appName == "Microsoft Internet Explorer") {
  17. document.getElementById('pkg').style.position = 'absolute';
  18. offx = parseInt((screen.availWidth - 662)/2);
  19. } else if (navigator.userAgent.indexOf('Firefox') == -1) {
  20. offx = parseInt((screen.availWidth - 644)/2);
  21. } else {
  22. if (document.body.scrollHeight > screen.availHeight) {
  23. offx -= 9;
  24. }}
  25. document.getElementById('contact').style.right = offx + 'px';
  26. document.getElementById('rtab').style.right = offx + 'px';
  27. document.getElementById('history').style.left = (offx + 12) + 'px';
  28. document.getElementById('ltab').style.left = offx + 'px';
  29. }
  30.  
  31. function opMenu(moveWho) {
  32. switch (moveWho) {
  33. case 'contact':
  34. if (roptab == 'closed') {
  35. roptab = 'open';
  36. intervlID = setInterval("moveMenu('" + moveWho + "')",menuDelay);
  37. } else {
  38. roptab = 'closed';
  39. intervlID = setInterval("closeMenu('" + moveWho + "')",menuDelay);
  40. }
  41. break;
  42. case 'history':
  43. if (loptab == 'closed') {
  44. loptab = 'open';
  45. intervlID = setInterval("moveMenu('" + moveWho + "')",menuDelay);
  46. } else {
  47. loptab = 'closed';
  48. intervlID = setInterval("closeMenu('" + moveWho + "')",menuDelay);
  49. }
  50. break;
  51. case 'services':
  52. var servis = document.getElementById('services').style.visibility;
  53. var rtabpos = parseInt(document.getElementById('rtab').style.right);
  54. var ltabpos = parseInt(document.getElementById('ltab').style.left);
  55. var cpos = parseInt(document.getElementById('contact').style.right);
  56. var hpos = parseInt(document.getElementById('history').style.left);
  57. if (servis == '' || servis == 'hidden') {
  58. offx -= 9;
  59. document.getElementById('services').style.visibility = 'visible';
  60. document.getElementById('servif').src='services.html';
  61. if (navigator.appName != "Microsoft Internet Explorer") {
  62. document.getElementById('rtab').style.right = (rtabpos - 9) + 'px';
  63. document.getElementById('contact').style.right = (cpos - 9) + 'px';
  64. document.getElementById('ltab').style.left = (ltabpos - 9) + 'px';
  65. document.getElementById('history').style.left = (hpos - 9) + 'px';
  66. }} else {
  67. offx += 9;
  68. document.getElementById('servif').src='#';
  69. document.getElementById('servif').style.height='0px';
  70. document.getElementById('services').style.visibility = 'hidden';
  71. if (navigator.appName != "Microsoft Internet Explorer") {
  72. document.getElementById('rtab').style.right = (rtabpos + 9) + 'px';
  73. document.getElementById('contact').style.right = (cpos + 9) + 'px';
  74. document.getElementById('ltab').style.left = (ltabpos + 9) + 'px';
  75. document.getElementById('history').style.left = (hpos + 9) + 'px';
  76. }}
  77. break;
  78. default:
  79. alert ('Error: opMenu');
  80. }}
  81.  
  82. function moveMenu(moveWho) {
  83. switch (moveWho) {
  84. case 'contact':
  85. var divRight = document.getElementById('rtab').style.right;
  86. var prsRight = parseInt(divRight);
  87. var endposrt = offx - 182;
  88. document.getElementById('rtabtab').src = 'images/tabs/rtabclose.png';
  89. if (prsRight <= endposrt) {
  90. clearInterval(intervlID);
  91. } else {
  92. document.getElementById('contact').style.right = (prsRight - menuSpeed) + 'px';
  93. document.getElementById('rtab').style.right = (prsRight - (menuSpeed + 14)) + 'px';
  94. }
  95. break;
  96. case 'history':
  97. var divLeft = document.getElementById('ltab').style.left;
  98. var prsLeft = parseInt(divLeft);
  99. var endposlft = offx - 182;
  100. document.getElementById('ltabtab').src = 'images/tabs/ltabclose.png';
  101. if (prsLeft <= endposlft) {
  102. clearInterval(intervlID);
  103. } else {
  104. document.getElementById('history').style.left = (prsLeft - menuSpeed) + 'px';
  105. document.getElementById('ltab').style.left = (prsLeft - (menuSpeed + 14)) + 'px';
  106. }
  107. break;
  108. default:
  109. alert('Error: moveMenu');
  110. }}
  111.  
  112. function closeMenu(moveWho) {
  113. switch(moveWho) {
  114. case 'history':
  115. var divLeft = document.getElementById('ltab').style.left;
  116. var prsLeft = parseInt(divLeft);
  117. document.getElementById('ltabtab').src = 'images/tabs/ltabopen.png';
  118. if (prsLeft >= offx) {
  119. clearInterval(intervlID);
  120. } else {
  121. document.getElementById('history').style.left = (prsLeft + (menuSpeed + 28)) + 'px';
  122. document.getElementById('ltab').style.left = (prsLeft + (menuSpeed + 14)) + 'px';
  123. }
  124. break;
  125. case 'contact':
  126. var divRight = document.getElementById('rtab').style.right;
  127. var prsRight = parseInt(divRight);
  128. document.getElementById('rtabtab').src = 'images/tabs/rtabopen.png';
  129. if (prsRight >= offx) {
  130. clearInterval(intervlID);
  131. } else {
  132. document.getElementById('contact').style.right = (prsRight + (menuSpeed + 28)) + 'px';
  133. document.getElementById('rtab').style.right = (prsRight + (menuSpeed + 14)) + 'px';
  134. }
  135. break;
  136. default:
  137. alert('Error: closeMenu');
  138. }}
  139.  
  140. onload = adjust;
  141. </script>
  142.  
  143. <title>Evergreen Landscape Inc</title>
  144. <META http-equiv="content-type" content="text/html; charset=utf-8">
  145. <link rel="stylesheet" type="text/css" href="css/style.css">
  146. </head>
  147. <body onresize="adjust()">
  148. <div id="egli"><img src="images/menu/egli.png"></div>
  149. <div id="pkg">
  150. <div id="ltab"><img id="ltabtab" src="images/tabs/ltabopen.png" onClick="opMenu('history')"></div>
  151. <div id="contact"><div id="contactinfo">If you're interested in our services, please use the contact information below to get in touch with us.<br><br><span class="bold">Paul Neefe Jr 
  152.  
  153. (Owner):</span><br>Phone - 585.392.9700<br>Fax - 585.395.9202<br><br>We serve the <span class="bold">Monroe</span> and <span class="bold">Orleans</span> areas. If you're not sure 
  154.  
  155. whether we'll come to you just give us a call! Also, don't forget that we're a part of the NYS Nursery Assoc. and participate in the annual Arbor Days celebration!</div></div>
  156. <div id="history"><div id="historyinfo">Established in 1984 by Paul Neefe Jr, Evergreen Landscape is your one stop solution for landscaping, lawn care, outdoor lighting and much much more! Having over 
  157.  
  158. 30 years of experience in the landscaping business means we know what you like. So, take a minute to familiarize yourself with the rest of the website and see what we have to offer! Remember, Evergreen has 
  159.  
  160. worked with such names as Kodak, Max Farash, Xerox and Blue Cross Blue Sheild. If we can satisfy them, than we're sure that we can satisfy you! So, if you're interested just click 'Contact Us' on our menu 
  161.  
  162. and give us a call or fax us a letter.</div></div>
  163. <div id="rtab"><img id="rtabtab" src="images/tabs/rtabopen.png" onClick="opMenu('contact')"></div>
  164. <div id="menu">
  165. <div id="historylnk"><a href="javascript:opMenu('history')" onFocus="this.blur()"></a></div>
  166. <div id="contactlnk"><a href="javascript:opMenu('contact')" onFocus="this.blur()"></a></div>
  167. <div id="serviceslnk"><a href="javascript:opMenu('services')" onFocus="this.blur()"></a></div>
  168. </div>
  169. <div id="services">
  170. <iframe onload="wrkIt()" src="#" height="0px" width="100%" scrolling="no" frameborder="0" id="servif"></iframe>
  171. </div>
  172. </div>
  173. </body>
  174. </html>
  175.  
Jun 19 '07 #1
4 2594
acoder
16,027 Expert Mod 8TB
Actually, you should give your iframes names. See this link.
Jun 20 '07 #2
Your answer (in a roundabout way) led me to a solution that I suppose will have to suffice. So, thanks. I believe that the problem that occured was due to a combination of browser bugs and malformed code (aka browser incompatibilities with particular forming). Now I'm trying to simply hide and make visible a div within the main page, and it works just fine, but when the page initially loads there's a scroll bar showing in both IE and FF (even though the information is in a 'hidden' state). Any ideas?

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2.                       "http://www.w3.org/TR/html4/strict.dtd">
  3.  
  4. <html>
  5. <head>
  6.  
  7. <script type="text/javascript">
  8. var menuDelay = 1;
  9. var menuSpeed = 1;
  10. var offx = parseInt((screen.availWidth - 633)/2);
  11. var roptab = 'closed';
  12. var loptab = 'closed';
  13. var intervlID;
  14.  
  15. function adjust() {
  16. if (navigator.appName == "Microsoft Internet Explorer") {
  17. document.getElementById('pkg').style.position = 'absolute';
  18. offx = parseInt((screen.availWidth - 662)/2);
  19. } else if (navigator.userAgent.indexOf('Firefox') == -1) {
  20. offx = parseInt((screen.availWidth - 644)/2);
  21. } else {
  22. if (document.body.scrollHeight > screen.availHeight) {
  23. offx -= 9;
  24. }}
  25. document.getElementById('contact').style.right = offx + 'px';
  26. document.getElementById('rtab').style.right = offx + 'px';
  27. document.getElementById('history').style.left = (offx + 12) + 'px';
  28. document.getElementById('ltab').style.left = offx + 'px';
  29. }
  30.  
  31. function opMenu(moveWho) {
  32. switch (moveWho) {
  33. case 'contact':
  34. if (roptab == 'closed') {
  35. roptab = 'open';
  36. intervlID = setInterval("moveMenu('" + moveWho + "')",menuDelay);
  37. } else {
  38. roptab = 'closed';
  39. intervlID = setInterval("closeMenu('" + moveWho + "')",menuDelay);
  40. }
  41. break;
  42. case 'history':
  43. if (loptab == 'closed') {
  44. loptab = 'open';
  45. intervlID = setInterval("moveMenu('" + moveWho + "')",menuDelay);
  46. } else {
  47. loptab = 'closed';
  48. intervlID = setInterval("closeMenu('" + moveWho + "')",menuDelay);
  49. }
  50. break;
  51. case 'services':
  52. var servis = document.getElementById('services').style.visibility;
  53. var rtabpos = parseInt(document.getElementById('rtab').style.right);
  54. var ltabpos = parseInt(document.getElementById('ltab').style.left);
  55. var cpos = parseInt(document.getElementById('contact').style.right);
  56. var hpos = parseInt(document.getElementById('history').style.left);
  57. if (servis == '' || servis == 'hidden') {
  58. alert (servis);
  59. offx -= 9;
  60. document.getElementById('services').style.visibility = 'visible';
  61. document.getElementById('services').style.height = '100%';
  62. if (navigator.appName != "Microsoft Internet Explorer") {
  63. document.getElementById('rtab').style.right = (rtabpos - 9) + 'px';
  64. document.getElementById('contact').style.right = (cpos - 9) + 'px';
  65. document.getElementById('ltab').style.left = (ltabpos - 9) + 'px';
  66. document.getElementById('history').style.left = (hpos - 9) + 'px';
  67. }} else {
  68. alert (servis);
  69. offx += 9;
  70. document.getElementById('services').style.visibility = 'hidden';
  71. document.getElementById('services').style.height='0px';
  72. if (navigator.appName != "Microsoft Internet Explorer") {
  73. document.getElementById('rtab').style.right = (rtabpos + 9) + 'px';
  74. document.getElementById('contact').style.right = (cpos + 9) + 'px';
  75. document.getElementById('ltab').style.left = (ltabpos + 9) + 'px';
  76. document.getElementById('history').style.left = (hpos + 9) + 'px';
  77. }}
  78. break;
  79. default:
  80. alert ('Error: opMenu');
  81. }}
  82.  
  83. function moveMenu(moveWho) {
  84. switch (moveWho) {
  85. case 'contact':
  86. var divRight = document.getElementById('rtab').style.right;
  87. var prsRight = parseInt(divRight);
  88. var endposrt = offx - 182;
  89. document.getElementById('rtabtab').src = 'images/tabs/rtabclose.png';
  90. if (prsRight <= endposrt) {
  91. clearInterval(intervlID);
  92. } else {
  93. document.getElementById('contact').style.right = (prsRight - menuSpeed) + 'px';
  94. document.getElementById('rtab').style.right = (prsRight - (menuSpeed + 14)) + 'px';
  95. }
  96. break;
  97. case 'history':
  98. var divLeft = document.getElementById('ltab').style.left;
  99. var prsLeft = parseInt(divLeft);
  100. var endposlft = offx - 182;
  101. document.getElementById('ltabtab').src = 'images/tabs/ltabclose.png';
  102. if (prsLeft <= endposlft) {
  103. clearInterval(intervlID);
  104. } else {
  105. document.getElementById('history').style.left = (prsLeft - menuSpeed) + 'px';
  106. document.getElementById('ltab').style.left = (prsLeft - (menuSpeed + 14)) + 'px';
  107. }
  108. break;
  109. default:
  110. alert('Error: moveMenu');
  111. }}
  112.  
  113. function closeMenu(moveWho) {
  114. switch(moveWho) {
  115. case 'history':
  116. var divLeft = document.getElementById('ltab').style.left;
  117. var prsLeft = parseInt(divLeft);
  118. document.getElementById('ltabtab').src = 'images/tabs/ltabopen.png';
  119. if (prsLeft >= offx) {
  120. clearInterval(intervlID);
  121. } else {
  122. document.getElementById('history').style.left = (prsLeft + (menuSpeed + 28)) + 'px';
  123. document.getElementById('ltab').style.left = (prsLeft + (menuSpeed + 14)) + 'px';
  124. }
  125. break;
  126. case 'contact':
  127. var divRight = document.getElementById('rtab').style.right;
  128. var prsRight = parseInt(divRight);
  129. document.getElementById('rtabtab').src = 'images/tabs/rtabopen.png';
  130. if (prsRight >= offx) {
  131. clearInterval(intervlID);
  132. } else {
  133. document.getElementById('contact').style.right = (prsRight + (menuSpeed + 28)) + 'px';
  134. document.getElementById('rtab').style.right = (prsRight + (menuSpeed + 14)) + 'px';
  135. }
  136. break;
  137. default:
  138. alert('Error: closeMenu');
  139. }}
  140.  
  141. onload = adjust;
  142. </script>
  143.  
  144. <title>Evergreen Landscape Inc</title>
  145. <META http-equiv="content-type" content="text/html; charset=utf-8">
  146. <link rel="stylesheet" type="text/css" href="css/style.css">
  147. </head>
  148. <body onresize="adjust()">
  149. <div id="egli"><img src="images/menu/egli.png"></div>
  150. <div id="pkg">
  151. <div id="ltab"><img id="ltabtab" src="images/tabs/ltabopen.png" onClick="opMenu('history')"></div>
  152. <div id="contact"><div id="contactinfo">If you're interested in our services, please use the contact information below to get in touch with us.<br><br><span class="bold">Paul Neefe Jr (Owner):</span><br>Phone - 585.392.9700<br>Fax - 585.395.9202<br><br>We serve the <span class="bold">Monroe</span> and <span class="bold">Orleans</span> areas. If you're not sure whether we'll come to you just give us a call! Also, don't forget that we're a part of the NYS Nursery Assoc. and participate in the annual Arbor Days celebration!</div></div>
  153. <div id="history"><div id="historyinfo">Established in 1984 by Paul Neefe Jr, Evergreen Landscape is your one stop solution for landscaping, lawn care, outdoor lighting and much much more! Having over 30 years of experience in the landscaping business means we know what you like. So, take a minute to familiarize yourself with the rest of the website and see what we have to offer! Remember, Evergreen has worked with such names as Kodak, Max Farash, Xerox and Blue Cross Blue Sheild. If we can satisfy them, than we're sure that we can satisfy you! So, if you're interested just click 'Contact Us' on our menu and give us a call or fax us a letter.</div></div>
  154. <div id="rtab"><img id="rtabtab" src="images/tabs/rtabopen.png" onClick="opMenu('contact')"></div>
  155. <div id="menu">
  156. <div id="historylnk"><a href="javascript:opMenu('history')" onFocus="this.blur()"></a></div>
  157. <div id="contactlnk"><a href="javascript:opMenu('contact')" onFocus="this.blur()"></a></div>
  158. <div id="serviceslnk"><a href="javascript:opMenu('services')" onFocus="this.blur()"></a></div>
  159. </div>
  160. </div>
  161. <div id="services">
  162. <div id="pkg">
  163. <div id="sintro">
  164. <span class="itac">Evergreen Landscape Inc offers a very wide variety of services. Please check our list below. If you don't see what you're looking for we would love for you to call and make a suggestion! Also, please make sure to check out our on-the-job photos for some quality assurance!</span>
  165. </div>
  166. <div id="smlpk">
  167. <div id="lserv">
  168. <br>Boulder Delivery &amp; Placement<br>Bushes &amp; Shrubs<br>Crabgrass Prevention<br>Debris Moving &amp; Hauling<br>Decks<br>Decorative Stone Delivery<br>Landscape Design<br>Site Analysis<br>Patios<br>Fences<br>Walkways<br>Retaining Walls<br>Outdoor Lighting<br>Site Plantings<br>Landscape Consultation<br>Soil Testing<br>Small Excavation<br>Sod Installation<br>Lawn Installation<br>Hydroseeding<br>Lawn Cutting<br>Lawn Feeding<br>Fertilization<br>Insect Control<br>Weed Control<br>Lawn Repair<br>Lawn Dethatching<br>Lawn Aeration<br>Lawn Rolling<br>Large Tree Transplanting<br>Tree Trimming<br>Tree Removal<br>Tree Cabling<br>Trimming &amp; Pruning<br>Spring &amp; Fall Clean Ups<br>Firewood<br>Snowplowing<br>Topsoil Delivery<br>Mulch Delivery<br>
  169. </div>
  170. <div id="rserv">
  171. <br>
  172. <a href="images/full/pic1.jpg" target="_blank"><img src="images/thumb/pic1.gif"></a>
  173. <a href="images/full/pic2.jpg" target="_blank"><img src="images/thumb/pic2.gif"></a>
  174. <a href="images/full/pic3.jpg" target="_blank"><img src="images/thumb/pic3.gif"></a>
  175. <a href="images/full/pic4.jpg" target="_blank"><img src="images/thumb/pic4.gif"></a>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. </body>
  181. </html>
Jun 20 '07 #3
Just posted that without using my brain. I'll just use display:none/block
Jun 20 '07 #4
acoder
16,027 Expert Mod 8TB
Oh well, glad you got it working.
Jun 20 '07 #5

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

Similar topics

2
by: Eric Pickup | last post by:
I'm having a problem with the following html (I've simplified it down to a simple test case). Could anyone point out why Mozilla is having problems with this (I've tried so many variations that I...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
2
by: yourmallu | last post by:
Hi Friends, All we are knowing that we can get the element by document.getelementbyid("default_txtname").value. But If it is not on that page if i am taking header.ascx and placing text box...
6
by: linuxnooby | last post by:
Hi I want a form field to be selected when the page loads. But I get the error message Error: document.getElementById("ff") has no properties any ideas what I am doing wrong? code below
3
by: rkhurana | last post by:
Hi I am writing a JSF application that uses some third party charts. While I can see the chart but the javascript that is supposed to calla function to update chart periodically has a problem. It...
4
by: gimme_this_gimme_that | last post by:
Hi, I have an onchange method for a select box that goes something like this (the select is in a form named aForm): function page_on_change() { pageElement = aForm.my_page_id;...
4
by: manjugi | last post by:
Hi, I am running som web application at some point i have one web page contains some buttons,text field etc.when i click on button it gives an error message stating that "error:...
2
by: ratcateme | last post by:
I have this script function getname(){ <script type="text/javascript"> var name = prompt('What is your name?'); while(name==''){ name = prompt('We need your name?'); } alert(name);...
6
by: maminx | last post by:
hello all, i have this html below <input type="text" name="items" size="3" value="1" onchange="javascript:showNameObject();"/> and i want to alert that object of name with this script ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.