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

Problem with DOM javascript with Firefox

1
Hello, everyone!

I have a javascript running perfectly with IE, but nothing seems to happend if I use firefox... anyone knows why?

Here is the script:
Expand|Select|Wrap|Line Numbers
  1. function add_div_field () {
  2.  
  3.     var ni = document.getElementById('upload_div');
  4.     var num = contador_upload++;
  5.     var div = document.createElement("div");
  6.     var div_name = "filediv"+num;
  7.     div.setAttribute("id",div_name);
  8.  
  9.     var table1 = document.createElement("<table width='100%' class='table0' border='0'>");
  10.  
  11.     var tbody1 = document.createElement("tbody");
  12.  
  13.     var tr1 = document.createElement("<tr width='100%' id='upload_table"+num+"'>");
  14.  
  15.  
  16.     var td1 = document.createElement("<td width='13'>");
  17.  
  18.  
  19.     var strong1 = document.createElement("strong");
  20.     var txtno = document.createTextNode(num+'.');
  21.  
  22.     strong1.appendChild(txtno);
  23.  
  24.     td1.appendChild(strong1);
  25.  
  26.     var td2 = document.createElement("<td width='700' valign='middle' class='grey_small'>");
  27.  
  28.  
  29.     var div2 = document.createElement("<div id='file"+num+"' class='showme'>");
  30.  
  31.  
  32.     var iframe = document.createElement("<iframe align='middle' marginheight='0' scrolling='no' marginwidth='0' frameborder='0' width='300' height='22' src='upload2.php?upload_id="+num+"'>");
  33.  
  34.  
  35.     div2.appendChild(iframe);
  36.  
  37.     var div3 = document.createElement("<div id='waiting"+num+"' class='hideme'>");
  38.  
  39.  
  40.     var txtwaiting = document.createTextNode('  Subiendo imagen, espera unos instantes...');
  41.     var br = document.createElement("br");
  42.  
  43.     var imgwaiting = document.createElement('<img src="pics/uploading.gif" width="220" height="19" align="absmiddle">');
  44.  
  45.  
  46.     div3.appendChild(txtwaiting);
  47.     div3.appendChild(br);
  48.     div3.appendChild(imgwaiting);
  49.  
  50.     var div4 = document.createElement("<div id='end_upload"+num+"' class='hideme'>");
  51.  
  52.  
  53.     var table2 = document.createElement("<table width='100%'>");
  54.  
  55.     var tbody2 = document.createElement("tbody");
  56.  
  57.     var tr2 = document.createElement("tr");
  58.  
  59.     var td3 = document.createElement("<td height='10'>");
  60.  
  61.     tr2.appendChild(td3);
  62.  
  63.     var tr3 = document.createElement("tr");
  64.     var td4 = document.createElement("td");
  65.     var txttitle = document.createTextNode("Título:");
  66.  
  67.     td4.appendChild(txttitle);
  68.     tr3.appendChild(td4);
  69.  
  70.     var tr4 = document.createElement("tr");
  71.     var td5 = document.createElement("td");
  72.  
  73.     var inputTitle = document.createElement("<input type='text' name='title["+num+"]' id='title["+num+"]'>");
  74.     var inputTitleName = "title["+num+"]";
  75.  
  76.     td5.appendChild(inputTitle);
  77.     tr4.appendChild(td5);
  78.  
  79.     var tr5 = document.createElement("tr");
  80.     var td6 = document.createElement("td");
  81.  
  82.     var txtdesc = document.createTextNode("Descripción Opcional:");
  83.  
  84.     td6.appendChild(txtdesc);
  85.     tr5.appendChild(td6);
  86.  
  87.     var tr6 = document.createElement("tr");
  88.     var td7 = document.createElement("td");
  89.  
  90.     var inputDesc = document.createElement("<textarea id='desc["+num+"]' name='desc["+num+"]' cols='40' rows='4'>");
  91.     var inputDescName = "desc["+num+"]";
  92.  
  93.     td7.appendChild(inputDesc);
  94.     tr6.appendChild(td7);
  95.  
  96.     var tr7 = document.createElement("tr");
  97.     var td8 = document.createElement("<td height='10'>");
  98.  
  99.     tr7.appendChild(td8);
  100.  
  101.     tbody2.appendChild(tr2);
  102.     tbody2.appendChild(tr3);
  103.     tbody2.appendChild(tr4);
  104.     tbody2.appendChild(tr5);
  105.     tbody2.appendChild(tr6);
  106.     tbody2.appendChild(tr7);
  107.  
  108.     table2.appendChild(tbody2);
  109.  
  110.     div4.appendChild(table2);
  111.  
  112.     td2.appendChild(div2);
  113.     td2.appendChild(div3);
  114.     td2.appendChild(div4);
  115.  
  116.     var td9 = document.createElement("<td width='21'>");
  117.  
  118.     var txtempty = document.createTextNode(" ");
  119.  
  120.     td9.appendChild(txtempty);
  121.  
  122.     var td10 = document.createElement("<td width='189'>");
  123.  
  124.     var imgphoto = document.createElement("<img src='pics/blank50x50.gif' id='photo"+num+"' name='photo"+num+"' width='50' height='50' class='upload_border'>");
  125.  
  126.     td10.appendChild(imgphoto);
  127.  
  128.     tr1.appendChild(td1);
  129.     tr1.appendChild(td2);
  130.     tr1.appendChild(td10);    
  131.  
  132.     tbody1.appendChild(tr1);
  133.  
  134.     table1.appendChild(tbody1);
  135.  
  136.     div.appendChild(table1);
  137.  
  138.     ni.appendChild(div);
  139.  
  140. }
Thanks!
May 17 '07 #1
1 3907
pbmods
5,821 Expert 4TB
Hello, everyone!

I have a javascript running perfectly with IE, but nothing seems to happend if I use firefox... anyone knows why?

Expand|Select|Wrap|Line Numbers
  1. var td1 = document.createElement("<td width='13'>");
  2.  
If I remember correctly, you can't pass HTML as an argument to document.createElement. In the case above, you would have to do this:

Expand|Select|Wrap|Line Numbers
  1. var td1 = document.createElement('td');
  2. td1.style.width = '13px';
  3.  
May 17 '07 #2

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

Similar topics

4
by: Dave Blair | last post by:
Hi, I have a problem with our intranet, we are planning to install Firefox instead of Internet Explorer onto some new PCs. However, we can't get the following JavaScript to work in Firefox and...
8
by: fuzzyman | last post by:
I have a very odd problem that has boggled my head. I've been trying to get a 2 column layout working with CSS. The problem seems to occur with the use of the <script> tag in the document, not the...
3
by: binnyva | last post by:
Hi everyone. I just made a JavaScript program to read a RSS feeds and display it in a HTML file. The script - Jasfer or JAvaScript FEed Reader - is available at...
2
by: John | last post by:
I've been working on making my ASP.NET web apps compatible with Firefox (the uplevel configs for web.config are a real help). However, one really weird thing is a GotoAnchor() function I have...
13
by: Giggle Girl | last post by:
Hi there, I am having a problem with the behavior of Firefox, where lefthand column content is not resized properly after it is "collapsed" and then "re-expanded". An online demo is available...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
3
by: sukhbir | last post by:
How to solve IE and Firefox problem? can anybody help me. IE When reloading a page in IE no form items are re-populated. When going back IE repopulates all form items but resets JavaScript...
3
by: willyWEB66 | last post by:
Hi everyone, I'm having problem with the sequence of execution for xml.onload. It works fine if your not passing parameters to onload event but my code needs to pass parameter to its function. I'm...
1
by: shidhincr | last post by:
I have some doubts regarding XML and XSL transfornation using javascript.Hope SomeOne will help me for solving this problem. Actually i Created a javascript for transforming XML and XSL. i made...
4
by: r_ahimsa_m | last post by:
Hello, I am learning WWW technologies in Linux. I created index.html file which I can browse with Firefox/Konqueror using URL localhost/~robert/rozgloszenia/index.html. The page looks fine but...
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...
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...
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.