Note that there are some explanatory texts on larger screens.

plurals
  1. POCross browser compatibility on various javascript elements
    primarykey
    data
    text
    <p>I am working on application to make it browser compatible.I have a jsp page which will call the Javascript functions for execution.Basically i am displaying a list of contents in my page for selection using a radio button.Here it goes</p> <p>JSP Page :</p> <pre><code> &lt;script language="JavaScript"&gt; loadcodes(10,'codesTable','#TheCodes',' ' ,'desc','&lt;%=compositeDescTagName%&gt;','&lt;%=compositeDescFormName%&gt;','&lt;%=codeFormName%&gt;','&lt;%=codeIdFormName%&gt;','document.resourceform.&lt;%=Globals.ENFORCE_COMMENTS%&gt;'); &lt;/script&gt;. </code></pre> <p>The above function will reference to the following js page </p> <pre><code>function loadcodes(depth,tableId,dataSrc,onclickfunc,descFld,compositeDescTagName,compositeDescFormName,codeFormName,codeIdFormName,enforceCommentsFormName) { document.writeln("&lt;TABLE height=100% id=PrimaryTable dataSrc='" + dataSrc + "' cellSpacing=0 cellPadding=0 border=0&gt; &lt;TBODY&gt;"); writeNode(depth,dataSrc,descFld,compositeDescTagName,compositeDescFormName,codeFormName,codeIdFormName,enforceCommentsFormName); document.writeln("&lt;/TBODY&gt;&lt;/TABLE&gt;"); } function writeNode(depth,dataSrc,descFld,compositeDescTagName,compositeDescFormName,codeFormName,codeIdFormName,enforceCommentsFormName) { if (depth &lt;= 0) return; document.writeln("&lt;TR onclick=\"toggle(this,'" + dataSrc + "','" + compositeDescTagName + "','" + compositeDescFormName + "','" + codeFormName + "','" + codeIdFormName + "','" + enforceCommentsFormName + "')\" class=tree_indent&gt;"); document.writeln("&lt;TD&gt;&lt;IMG dataFld='image' id=Icon class=tree_node&gt;"); document.writeln("&lt;SPAN dataFld=" + descFld + " class=formtext&gt;&lt;/SPAN&gt;"); document.writeln("&lt;SPAN dataFld=haschildren id=HasChildren style='DISPLAY:none'&gt;&lt;/SPAN&gt;&lt;SPAN dataFld=isleaf id=isleaf style='DISPLAY: none'&gt;&lt;/SPAN&gt;&lt;SPAN dataFld=composite_desc id=composite_desc style='DISPLAY:none'&gt;&lt;/SPAN&gt;"); document.writeln("&lt;SPAN dataFld=composite_code id=composite_code style='DISPLAY:none'&gt;&lt;/SPAN&gt;"); document.writeln("&lt;SPAN dataFld=composite_id id=composite_id style='DISPLAY:none'&gt;&lt;/SPAN&gt;"); document.writeln("&lt;SPAN dataFld=comments_required id=comments_required style='DISPLAY:none'&gt;&lt;/SPAN&gt;"); document.writeln("&lt;/TD&gt;&lt;/TR&gt;"); document.writeln("&lt;TR style='DISPLAY: none' class=tree_indent&gt;"); document.writeln("&lt;TD&gt;&lt;!-- next level --&gt;"); document.writeln("&lt;TABLE class=tree_node id=node dataFld=node valign=top border=0 cellSpacing=1 cellPadding=1 &gt;"); document.writeln("&lt;TBODY&gt;"); writeNode(--depth,dataSrc,descFld,compositeDescTagName,compositeDescFormName,codeFormName,codeIdFormName,enforceCommentsFormName); document.writeln("&lt;/TBODY&gt;"); document.writeln("&lt;/TABLE&gt;"); document.writeln("&lt;/TD&gt;"); document.writeln("&lt;/TR&gt;"); } var selectedCode; function toggle(e,dataSrc,compositeDescTagName,compositeDescFormName,codeFormName,codeIdFormName,enforceCommentsFormName) { var nextRow; var nextRow1; nextRow = e.nextSibling; hc = e.all.HasChildren; var isleaf = e.all.isleaf; if (nextRow.style.display == "none" &amp;&amp; isleaf.innerText == "false") { nextRow.style.display = ""; e.all.Icon.src = "/edcs/images/minus.gif"; if (nextRow.all &amp;&amp; nextRow.all[2] &amp;&amp; !nextRow.all[2].dataSrc) { nextRow.all[2].dataSrc = dataSrc; } } else if (isleaf.innerText == "true") { // reset the bullet on the one already selected if (selectedCode &amp;&amp; selectedCode.all &amp;&amp; selectedCode.all.Icon) selectedCode.all.Icon.src = "/edcs/images/bullet.gif"; e.all.Icon.src = "/edcs/images/right.gif"; re=/'/g; var str = e.all.composite_desc.innerText.replace(re,"\\'"); eval(compositeDescTagName + ".innerText = '" + str + "'"); eval(compositeDescFormName + ".value = '" + str + "'"); eval(codeFormName + ".value = '" + e.all.composite_code.innerText + "'"); eval(codeIdFormName + ".value = '" + e.all.composite_id.innerText + "'"); commentsEnforced = eval(enforceCommentsFormName + ".value"); if (commentsEnforced == "false") eval(enforceCommentsFormName + ".value = '" + e.all.comments_required.innerText + "'"); selectedCode = e; } else { nextRow.style.display = "none"; e.all.Icon.src = "/edcs/images/plus.gif"; } } </code></pre> <p>This flow works well in IE browsers but not supported by other browsers.While searching i found the list of elements supported only by IE 1.DataSrc 2.Datafld &amp; also IMG datafld.</p> <p>Is there any alternative for the above elements with browsers or how could the modifications made in the code so that it is browser compatbile.Kindly help and also it would be turn out be a template for cross browser testing...Thanks a lot </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload