I have the following code in an html page it should basically create a hidden input field on the page that looks something like this:
<input name="snippet1" type="hidden" value="<%=formFields.getValue("fieldName")%>" />
<-------------- HTML ------------->
<script>hiddenField()</script><%=formFields.getValue("clientName"%>
<script>column3()</script>
<-------------- JAVASCRIPT ------------->
function hiddenField(){
document.write('<input name="snippet' + (snippetNum+1) + '" type="hidden" value="')
}
function column3() {
document.write('"/></td><td width="' + column3Width + '" style="vertical-align: bottom;"><input type="button" name="copy' + buttonNum + '" value="Copy" onClick="copy('+ buttonNum + ')" class="button-small" /></td>');
document.write('</tr>');
snippetNum++;
buttonNum++;
}
The function hiddenField() should wrap the beginning of a hidden input field around the "<%=formFields.getValue("clientName"%>" and
function column3() has the end of that tag "/>" but for some reason it's displaying the code rather than creating the input field. If I remove the "/>" from the column3() and place on the html page behind the this code like so "<%=formFields.getValue("clientName"%>/>" with no changes to the hiddenField function it works fine. This only happens in IE, works fine either way in Firefox. It's as if the IE browers runs the hiddenField function and since that ending tag is not present it interprets it as text and then calls the column3() function and since it already has displayed the "<%=formFields.getValue("clientName"%>" it doesn't know what to do with the "/>" so it displays it as well. Does anyone know of a fix for this or have had this problem before?
<input name="snippet1" type="hidden" value="<%=formFields.getValue("fieldName")%>" />
<-------------- HTML ------------->
<script>hiddenField()</script><%=formFields.getValue("clientName"%>
<script>column3()</script>
<-------------- JAVASCRIPT ------------->
function hiddenField(){
document.write('<input name="snippet' + (snippetNum+1) + '" type="hidden" value="')
}
function column3() {
document.write('"/></td><td width="' + column3Width + '" style="vertical-align: bottom;"><input type="button" name="copy' + buttonNum + '" value="Copy" onClick="copy('+ buttonNum + ')" class="button-small" /></td>');
document.write('</tr>');
snippetNum++;
buttonNum++;
}
The function hiddenField() should wrap the beginning of a hidden input field around the "<%=formFields.getValue("clientName"%>" and
function column3() has the end of that tag "/>" but for some reason it's displaying the code rather than creating the input field. If I remove the "/>" from the column3() and place on the html page behind the this code like so "<%=formFields.getValue("clientName"%>/>" with no changes to the hiddenField function it works fine. This only happens in IE, works fine either way in Firefox. It's as if the IE browers runs the hiddenField function and since that ending tag is not present it interprets it as text and then calls the column3() function and since it already has displayed the "<%=formFields.getValue("clientName"%>" it doesn't know what to do with the "/>" so it displays it as well. Does anyone know of a fix for this or have had this problem before?