I am using weblogic 8.1.6. My problrm is I have a parent page that is using Ajax to call a child page. The Child page is executed Into the Parent Page. Parent page has a form and a javascript function to read all the elements of the form but the javascript function is not able to read the elements of child page. I am using " form.elements[i].name " which is working fine in IE but not in firefox and chorme . What should i use to read the element of child page that is executed inside parenPage.
parent code
<form id="Tab">
<input type="button" onclick="alert('calling AjaX Method');" value="ADD" />
<div id="ChildOutputWillDisplayedHere"></div>
</form>`
childCode
<input class="FormFields" type = "text" name = "NameID" value = "">
<a href="#" onclick="callingJavscriptFunction()">click Me </a>`
javascript code
callingJavscriptFunction(){
var form = document.forms['tab'];
for(var i=0; i<form.elements.length; i++)
{
var fieldName = form.elements[i].name;
}
}
It seems, that IE gives you all input-elements in the form, even if they didn't have name
-attribute. Your input
in Tab
however lacks the name
-attribute, which you try to read in the function. AFAIK this code will assign undefined
to fieldName
in IE also.
Looping like this will assign only the name
of the last element in the elements
-collection to your fieldName
-variable. No problem with one input
-element, but if there are more...