ravikrishnasai
08-23-2007, 04:39 PM
Hi, my issue is the below code is not working in Mozilla browser. I want to generate a file item whenever i click a link. the corresponding script method is called when i click the link and also the table body which it refers. In IE the new file items are generating fine but in Mozilla one small horizontal space is generated each time instead of file item. appreciate you help.
function addFile()
{
if(document.all){
alert("IE");
var table = document.all["fileInput"]
var row = table.insertRow();
row.value = upload_number;
var cell = row.insertCell(0);
cell.innerHTML= "<tr valign=top><td colspan=2 class=txt-label><crTag:displayText Text="" keyText=""/></td><td width=429>";
cell = row.insertCell(0);
cell.innerHTML= "<div align=left>";
cell = row.insertCell(0);
cell.innerHTML = "<input class=input type=file name='filename"+upload_number+"' id=fileName />";
cell = row.insertCell(0);
cell.innerHTML = "</div></td></tr>";
cell = row.insertCell(0);
upload_number++;
}
else{
alert("mozilla");
var table = document.getElementById("fileInput");
var row = table.insertRow(0);
row.value = upload_number;
var cell = row.insertCell(0);
cell.innerText= "<tr valign=top><td colspan=2 class=txt-label><crTag:displayText Text="" keyText=""/></td><td width=429>";
cell = row.insertCell(1);
cell.innerText= "<div align=left>";
cell = row.insertCell(2);
cell.innerText = "<input class=input type=file name='filename"+upload_number+"' id=fileName />";
cell = row.insertCell(3);
cell.innerText = "</div></td></tr>";
cell = row.insertCell(4);
upload_number++;
}
}
Below the table that the method refers:-
<table id="fileInput" border="0" cellspacing=1 cellpadding=1 width="100%" >
<div align="left">
<input class="input" type="file" name="filename" id="fileName" />
<div><a href="javascript:addFile();"><crTag:displayText Text="Attach More Files" keyText="" locale="<%=locale%>"/></a></div>
<!-- style="display:none;" -->
</div>
</table>
function addFile()
{
if(document.all){
alert("IE");
var table = document.all["fileInput"]
var row = table.insertRow();
row.value = upload_number;
var cell = row.insertCell(0);
cell.innerHTML= "<tr valign=top><td colspan=2 class=txt-label><crTag:displayText Text="" keyText=""/></td><td width=429>";
cell = row.insertCell(0);
cell.innerHTML= "<div align=left>";
cell = row.insertCell(0);
cell.innerHTML = "<input class=input type=file name='filename"+upload_number+"' id=fileName />";
cell = row.insertCell(0);
cell.innerHTML = "</div></td></tr>";
cell = row.insertCell(0);
upload_number++;
}
else{
alert("mozilla");
var table = document.getElementById("fileInput");
var row = table.insertRow(0);
row.value = upload_number;
var cell = row.insertCell(0);
cell.innerText= "<tr valign=top><td colspan=2 class=txt-label><crTag:displayText Text="" keyText=""/></td><td width=429>";
cell = row.insertCell(1);
cell.innerText= "<div align=left>";
cell = row.insertCell(2);
cell.innerText = "<input class=input type=file name='filename"+upload_number+"' id=fileName />";
cell = row.insertCell(3);
cell.innerText = "</div></td></tr>";
cell = row.insertCell(4);
upload_number++;
}
}
Below the table that the method refers:-
<table id="fileInput" border="0" cellspacing=1 cellpadding=1 width="100%" >
<div align="left">
<input class="input" type="file" name="filename" id="fileName" />
<div><a href="javascript:addFile();"><crTag:displayText Text="Attach More Files" keyText="" locale="<%=locale%>"/></a></div>
<!-- style="display:none;" -->
</div>
</table>