|
From: Ben S. <ben...@tr...> - 2000-10-25 17:58:27
|
The difference between Netscape and IE in terms of accessing forms on a
layer is that Netscape treats the layer as a separate document.
IE: document.formname.formelement.value
NS: document.layer.document.formname.formelement.value
The trick I use, which works when your event is being triggered by the
form itself, is to pass the calling object to your function. For
example:
function validate(obj) {
for (var i=0; i<obj.form.length; i++) {
alert(obj.form[i].value);
}
}
// and then in a div somewhere...
<form name="myForm">
Name: <br><input name="name"><br>
<input type="button" value="submit" onclick="validate(this);">
</form>
This code will just print out the values of your form in alert boxes.
Hopefully that will give you some ideas.
ben
Matthew wrote:
>
> hey love the new DYNAPI2 .. just started using it yesterday and find it very
> intuitive and somewhat fun...
>
> What I am trying to do is allow form elements to be filled out and then add
> this information to a different layer....
>
> so I am extracting the form elements out through javascript, assigning each
> to a variable then adding these variables to the setHTML() method...
> this works in IE as I can access the form elements directly through the
> document.forms.formname.formelement.value... but NS it seams to be a
> different story.. I am assuming that because the form is on a layer that I
> have to somehow access the form through the layer... but I am not sure how
> the DYNAPI writes to the DOM for me to access.. looking at IEs DOM the
> DYNAPI2 writes JSDynLayer0, etc but I cannot seam to access the form
> referencing this in netscape..
>
> eg document.layers.JSDynLayer0.formname.formelement.value
>
> so i am hoping that you have any sugestions..
>
> Thanks MattieK
>
> _______________________________________________
> Dynapi-Help mailing list
> Dyn...@li...
> http://lists.sourceforge.net/mailman/listinfo/dynapi-help
|