Solved

Window.frames.count don't work!!

Posted on 2001-07-23
6
945 Views
Last Modified: 2007-11-27
Why doesn't this piece of code work?

The ultimate aim is to get a value into the textbox on A_form-main from form-main

The error is Object does not support this property or method 'Window.frames.count'


Listing:form-main

<html>
<head>
<title>Welcome to RightFax
</title>

<body bgcolor=#FFFFFF>

<FRAMESET border="0" cols="25%, *">
  <FRAME src="A_form-main" NAME=RightFax_Main>
  <FRAME src="Test.asp">
</FRAMESET>

<SCRIPT LANGUAGE=VBScript>
<!--
msgbox Window.frames.count
-->
</SCRIPT>
</body>
</head>
</html>



Listing:test.asp

<%@LANGUAGE=VBScript%>

<%

If Request.ServerVariables("QUERY_STRING") <> "" then
    response.write "<html><head><title>A title</title><body>Clicked</body></head></html>"
else

%>

<html>
<head>
<title>A title</title>
<body>
<FORM METHOD=GET ID=Form1 NAME=Form1>
Body
<p NAME="P">P</P>
<INPUT TYPE=SUBMIT value="Hello">
<INPUT TYPE=TEXT value="MyText" NAME="Text1">
</FORM>
</body>
<%End If%>
</head>
</html>


A_form-main

<html>
<head>
<title>
RightFAX Main Menu
</title>
</head>

<body bgcolor=#FFFFFF>
<FORM>
<INPUT TYPE=TEXT NAME=UnreadFax>
</FORM>
</BODY>
</HTML>

0
Comment
Question by:andcu
6 Comments
 
LVL 4

Expert Comment

by:jcs_clement
ID: 6308147
Well you can do this by using Javascript instead of VBScript on the client side.

<script language="javascript">
function fun(){
alert(window.frames.length)
}
<script>

<body OnLoad="fun()">


but remember that this is case sensitive :)

rgds
jcs
0
 
LVL 2

Accepted Solution

by:
DirkVe earned 50 total points
ID: 6308191
multiple problems:

1- You cannot add extra things (like text or code) in a page that defines the frames. A typical main frame looks like this:

<BODY>
<FRAMESET border="0" cols="25%, *">
 <FRAME src="frTest2.htm" NAME=RightFax_Main>
 <FRAME src="frTest2.htm" name="ikke">
</FRAMESET>
</BODY>

Any extra SCRIPT will not execute.

A solution is to write it in the BODY-ONLOAD.

2-
it's not
window.frames.count
BUT
window.frames.length

3- it will always return 0 because you're frames are not loaded yet (don't exist) when you load the 'main frame'.
0
 

Author Comment

by:andcu
ID: 6308205
More detail covered here.  I can't accept two answers unforunately!!
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:jcs_clement
ID: 6310989
Hi buddy,

well you can do that. You will have to ask the help desk people to do it :-)

Desperate to earn points yeah !! :)

rgds
jcs
0
 
LVL 3

Expert Comment

by:modder
ID: 6312215
Hi andcu,

How would you like to split the points, 50/50?

modder
Community Support
0
 

Expert Comment

by:ComTech
ID: 6685651
Split was never completed, I will leave a question for jcs_clement in this Topic Area.

Best regards,
ComTech
Community Support
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON error 4 70
Query to get the soonest date out of a few records 2 51
Need help to rewrite script 3 94
VBScript on Html 15 47
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question