473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Debug my javascript issue with forms and frames

You can consider me an amature. I can't figure this one out. Hopefully, I can explain it well enough.

Here's the structure of my page:

***myASPpage.asp***
(contains a frame inclosed in a div)
<frame id=myFrame>
|
V

***mySearch.asp***
(contains a form with two select fields)
<form id=searchForm>
fields: model & serial
|
V

***myScript.asp***
(a script that populates the serial field with distinct serial numbers based on the model number choosen)

On this page, I'm trying to reference the "serial" field from "searchForm" and get it's length using this code:

Expand|Select|Wrap|Line Numbers
  1. parent.frames['myFrame'].document.form('searchForm').getElementById('serial').options.length;


But, it gives me "null or object not found". Oddly, I've gotten my code to work perfectly fine if I don't use an iFrame and keep all the code from "myScript.asp" on the same page as "mySearch.asp". So, I'm thinking I'm not doing something correctly due to the frame.
Mar 1 '11 #1

✓ answered by acoder

That line of JavaScript is invalid syntax. Either try:
Expand|Select|Wrap|Line Numbers
  1. parent.frames['myFrame'].document.forms['searchForm'].serial.options.length;
or if serial has an ID:
Expand|Select|Wrap|Line Numbers
  1. parent.frames['myFrame'].document.getElementById('serial').options.length;

4 1632
acoder
16,027 Expert Mod 8TB
That line of JavaScript is invalid syntax. Either try:
Expand|Select|Wrap|Line Numbers
  1. parent.frames['myFrame'].document.forms['searchForm'].serial.options.length;
or if serial has an ID:
Expand|Select|Wrap|Line Numbers
  1. parent.frames['myFrame'].document.getElementById('serial').options.length;
Mar 2 '11 #2
Thanks for the reply. I'm still getting the error:

Message: 'parent.frames.myFrame.document' is null or not an object


I've read tons of tutorials on these tree structures, but I guess I'm still missing something.
Mar 2 '11 #3
acoder
16,027 Expert Mod 8TB
myFrame should be the name of the frame:
Expand|Select|Wrap|Line Numbers
  1. <frame name="myFrame" ...>
Mar 2 '11 #4
I figured it out. Your original solution was correct minus one small thing (on my end). The last script (asp page) was opening as new window. So I had to use:

"opener" instead of "parent"
Mar 2 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: William.R.Reisen | last post by:
Hi, I have been reading this article of how to impliment frames so they stay framed in lots of different browsers: http://tech.irt.org/articles/js126/index.htm Not being very techy I am...
4
by: Andrew Clark | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** hello, i am trying to create a login page to my website. there are the usual fields for name and password, but i want 2 more: a...
2
by: apngss | last post by:
Is there any way to debug javascript in a web application? When I develop JSP pages, and it has the javascript code in it. The problem is the debugger in Java IDE (WSAD in my case) can only debug...
1
by: yma | last post by:
Hi, I have an asp.net app that I uses javascript in the html file. Can you show me how to debug javascript in vb.net. I use vb.net in vs.net. Here is a sample html file. If I cannot use...
1
by: bonnie.tangyn | last post by:
Hello all Would it be possible to store javascript document.forms.value to ASP session as global variable? If it is not possible, how can I pass the javascript document.forms.value to...
2
by: bonnie.tangyn | last post by:
Hello all Would it be possible to store javascript document.forms.value to ASP session as global variable? If it is not possible, how can I pass the javascript document.forms.value to...
2
by: Dinh Bao Tuyen | last post by:
Hi everyone, I can't debug javascript in VS 2005. In my VS2005, I can't find Script Explorer in menu. Can u help me???
4
by: dotcom | last post by:
hello friends, i have written javascript code for fixed header of html table it works fine in IE and in Firefox it works without fixed header and not showing any error .how can i debug javascript...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.