473,382 Members | 1,814 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,382 software developers and data experts.

problem with Firefox and change an element text

mickey0
142 100+
Hi, I have some problems with this code that works with IE but don't with FF (see the comments):
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <script>
  3. function myFunc () {
  4.     var element = document.getElementById("intro");
  5.     alert("element " + element.innerHTML);   //in FF it  print an empty string
  6.     //element.innerHTML += "otherText"; //what code to do this ? (inside tbody  
  7.     //that doesn't work!)
  8. }   
  9. </script>
  10.  
  11. <head>
  12.  </head>
  13.  
  14.  <body onload="myFunc()">
  15.     <table>
  16.         <tbody id="intro"> Pages Title</tbody>
  17.     </table>
  18. </body>
  19. </html>
  20.  
Thanks
Jan 19 '08 #1
1 1203
Logician
210 100+
Expand|Select|Wrap|Line Numbers
  1. ]
  2. <table>
  3.         <tbody id="intro"> Pages Title</tbody>
  4.     </table>
  5. </body>
  6. </html>
  7.  
Try starting out with some valid table HTML:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type='text/javascript'>
  4. function myFunc ()
  5. {
  6.  var element = document.getElementById("intro");
  7.  alert("element " + element.innerHTML);   //in FF it  print an empty string
  8.  element.innerHTML += "otherText"; //what code to do this ? (inside tbody  
  9.  alert(element.innerHTML);
  10. }   
  11. </script>
  12. </head>
  13.  <body onload="myFunc()">
  14.    <table>
  15.      <tbody id="intro"><tr><td>Pages Title</td></tr></tbody>
  16.    </table>
  17. </body>
  18. </html>
Jan 20 '08 #2

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

Similar topics

1
by: Ryan Stewart | last post by:
If you don't want to read this post because of its length, I understand. I've spent two and a half days on this problem and have a good deal of information to relate. And this is kind of a long...
6
by: joe | last post by:
Hi Everyone, could anyone comment on the following problem: I have a textbox being appended to a cell in a table, and am trying to call focus() on like this: <snip> c01.removeChild(answerbox);...
5
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
1
by: KPS | last post by:
I'm attempting to create a simple treeview-like behavior in JavaScript. The desired behavior happens in IE but I cannot get the same to happen in FireFox. The primary thing I want to accomplish...
3
by: Capricorn | last post by:
Hi, can anybody tell me how you can create a new stylesheet inside a (X)HTML page with JavaScript and Firefox, if the stylesheet is only available as a variable value, like: var CSSStyle =...
2
by: ranger7419 | last post by:
I'm trying to figure out why this script will work in IE 6 but not Firefox, and so I need someone here with a far better grasp on javascript to explain this. Basically, I have a page with several...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
8
by: Candoer | last post by:
I am new to both HTML and CSS. Several months ago my High School Alumni association web master died and they asked me to take over the web site. I had never worked with CSS but had some experience...
8
by: cyqotiq | last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet. Second, let me state that this is not the typical "getElementById not working Firefox"...
15
by: Sunny | last post by:
Hi, I can change the lement opacity in IE using. abc.style.filter = 'alpha(opacity=' + 10 + ')'; But this dont work in firefox, In firefox it throws error. How I can change the opacity of an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.