View Full Version : Code suggestions for Netscape
gblair
10-22-2002, 01:46 AM
I have 2 javascript functions that work great in IE but not at all in Netscape and I was wondering if anyone could suggest the comparable code in Netscape or an alternative piece of code that would work in both environments. The functions in question simply add/delete a table row dynamically:
function addRow(table) {
var blankRow=table.rows["blankRow"];
var newRow=table.insertRow();
for (i=0; i<blankRow.cols; i++) {
newRow.insertCell().innerHTML = blankRow.cells[i].innerHTML;
}
rowID++
}
function deleteRow(table) {
var newRow=table.deleteRow(rowID);
rowID--;
}
By the way "blankRow" is id of the pre-defined table row I am appending to my table.
Once again: this works fine in IE but not in Netscape and I would very much appreciate any advice on how to make it work in Netscape or (even better) both environments.
Regards,
Geoff
chrismiceli
10-22-2002, 03:42 AM
could i see the html part of the code because i am not sure if what I am thinking is right or not.
Catman
10-22-2002, 02:44 PM
Try adding these lines to the addRow function right after the for loop:
table.style.display="none";
table.style.display="block";
This might solve the problem for Netscape 6.0+ ...
gblair
10-22-2002, 06:30 PM
Chrismiceli:
Here's the HTML code I am using. By the way, I'm
using ColdFusion as well. I don't think it would
make a difference in this case though.
<cfform name="myForm" method="post" action="cribMainList.cfm" target="cribSearchAction">
<table>
<tr>
<td> <strong>Keywords</strong> </td>
<td> <strong>Reference Types</strong> </td>
<td> <strong>TIPS</strong> </td>
</tr>
<tr>
<!--- Keyword List --->
<td> <select name="sKeywords" size="5" multiple>
<cfoutput query="qKeywords">
<option value="#qKeywords.keyword#">#qKeywords.keyword#
</cfoutput> </select> </td>
<!--- Reference List --->
<td> <select name="sReferences" size="5" multiple>
<cfoutput query="qReferences">
<option value="#qReferences.reference_type_id#">#qReferences.name#
</cfoutput> </select> </td>
<!--- Project List --->
<td> <select name="sProjects" size="5" multiple>
<cfoutput query="qProjects">
<option value="#qProjects.project_id#">#qProjects.project_id#
</cfoutput> </select> </td>
</tr>
</table>
<p></p>
<table border=0 id="myTable">
<tr>
<td> </td>
<td> <strong>Column</strong> </td>
<td> <strong>Operator</strong> </td>
<td> <strong>Search Term</strong> </td>
</tr>
<tr id="blankRow" cols=4 style="display:none">
<td id="myColumn"> <select name="myAndOr">
<option value="" >  
<option value="and" > And
<option value="or" > Or
<option value="and not"> Not </select> </td>
<td width="235"> <select name="MySelect">
<option value="reference_id" > Reference ID
<option value="authors" > Authors
<option value="title" > Title
<option value="publ_details" > Publication Details
<option value="abstract" > Abstract
<option value="comments" > Comment
<option value="held" > Is Held
<option value="spec_chars" > Has Special Characters
<option value="qc" > Quality Checked </select> </td>
<td width="235"> <select name="myOperator">
<option value="like" >contains
<option value="=" >=
<option value=">" >>
<option value="<" ><
<option value=">=" >>=
<option value="<=" ><=
<option value="<>" ><> </select> </td>
<td width="235"> <input type="text" name="searchTerm" value="" size=20 maxlength=80 >
</td>
</tr>
</table>
<p></p>
<table width="100%" border="0">
<tr>
<td width="62%">
<input type="button" name="btnAddRow" value="Add Row" onClick="addRow(myTable);">
<input type="button" name="btnDelRow" value="Delete Row" onClick="deleteRow(myTable);">
<input type="submit" name="btnDoQuery" value="Submit" onClick="populateHidden()">
<input type="button" name="reset" value="Reset" onclick="myReset()">
<input type="hidden" name="fullTextString">
<input type="hidden" name="queryString">
</td>
<td width="38%"> <input type="button" value="Go Query Search" onclick="goQuerySearch()"></td>
</tr>
</table>
<p> </p>
</cfform>
gblair
10-22-2002, 06:31 PM
Catman:
Thanks for responding. I tried what you suggested but it didn't seem to work.
Geoff
Catman
10-22-2002, 11:11 PM
Bummer. It worked for a little problem I was having with innerHTML and Netscape 6.
Perhaps if you use the technique on ccform element, first adding in an appropriate id attribute (like id="myForm") then doing this:
cForm=document.getElementById("myForm");
cForm.style.display="none";
cForm.style.display="block";
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.