473,241 Members | 1,446 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,241 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 3904
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: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.