[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 952
  • Last Modified:

Window.frames.count don't work!!

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
andcu
Asked:
andcu
1 Solution
 
jcs_clementCommented:
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
 
DirkVeCommented:
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
 
andcuAuthor Commented:
More detail covered here.  I can't accept two answers unforunately!!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jcs_clementCommented:
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
 
modderCommented:
Hi andcu,

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

modder
Community Support
0
 
ComTechCommented:
Split was never completed, I will leave a question for jcs_clement in this Topic Area.

Best regards,
ComTech
Community Support
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now