|
-
Oct 2nd, 2003, 02:22 PM
#1
Thread Starter
Fanatic Member
Is Null or not an object
I am trying to place the value of the variables into this url but I keep getting this error on my variables:
<script language = javascript>
var Address1 = FORM1.Address1.value
var Address2 = FORM1.Address2.value
var Province1 = FORM1.Province1.value
var Province2 = FORM1.Province2.value
window.open('http://www.mapquest.com/directions/main.adp?go=1&do=nw&ct=NA&1y=US&1a=" & Address1 & "&1p=&1c=" & City1 & " &1s=" & Province1 & "&1z=&1ah=&2y=US&2a=" & Address2 & "&2p=&2c=" & City2 & "&2s=" & Province2.value & "&2z=&2ah=&lr=2&x=66&y=11','NewWindow')
</script>
I keep getting the error:
Line 17: Error: 'FORM1.Address1.value' is null or not an object
My form is named FORM1...
What other ways can I try for example:
window.document.FORM1.Address1.value
-
Oct 3rd, 2003, 10:12 AM
#2
Stuck in the 80s
try:
Code:
document.forms('FORM1').Address1.value
-
Oct 3rd, 2003, 02:55 PM
#3
Member
Not sure how things have changed over the years, but you've gotta follow the hierarchy of objects. The highest is window, then document, then there comes in your form.
So document.<formname>.<fieldname>.value should work. So try putting 'document.' infront of your FORM1
Code:
var Address1 = document.FORM1.Address1.value
var Address2 = document.FORM1.Address2.value
var Province1 = document.FORM1.Province1.value
var Province2 = document.FORM1.Province2.value
Or see if Hobo's code works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|