not quite;
you have to qualify each object with it's parentage.
so this;
Code:
var name = name.value;
var email = email.value;
would be
Code:
var name = document.formname.name.value;
var email = document.formname.email.value;
Unlike many OOP languages, javascript has no with object qualifier, but you can assign the parent(s) to a variable and use that. So it can be shortened to
Code:
var parent = document.form;
var name = parent.name.value;
var email = parent.email.value;
And there are of course several other ways to reference an element.
__________________
Chris. ->> Please login or register to view this content. Registration is FREE <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
|