|
-
Feb 15th, 2001, 01:01 AM
#1
Thread Starter
Addicted Member
Is it possible to call a function on a parent page from the child?
I have a page loaded in a IFRAME and I wand to call a function on the parent page?
Can this be done and HOW???
-
Feb 15th, 2001, 04:01 AM
#2
-
Feb 15th, 2001, 07:32 AM
#3
Retired VBF Adm1nistrator
Im no expert on this stuff, but what if you used the name of the frame in the call ?
Eg :
Code:
<SCRIPT LANGUAGE="VBScript">
'Some sub ...
Frame1.function(param1, param2 ...)
'End Sub
</script>
- jamie
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 17th, 2001, 06:35 AM
#4
Fanatic Member
I have the same problem...
Hi I want to know the same thing
see this post for more info
http://forums.vb-world.net/showthrea...threadid=54962
DocZaf
{;->
-
Feb 18th, 2001, 09:26 PM
#5
Addicted Member
Here is what you have to do:
<Script language = "VBScript">
Window.Parent.Frames("Top").Test()
</script>
I have tested it. It works.
Why do you want to do this? There is a better way. You can create a .vbs file and use the following in your page:
<script language = "VBScript" src="Functions.vbs">
</script>
<script language = "VBScript">
Test
</script>
Last edited by Shafee; Feb 18th, 2001 at 09:40 PM.
-
Feb 18th, 2001, 10:44 PM
#6
Fanatic Member
I have tested it. It works.
Why do you want to do this? There is a better way. You can create a .vbs file and use the following in your page:
<script language = "VBScript" src="Functions.vbs">
</script>
<script language = "VBScript">
Test
</script>
Okay so that works for htm file what if its an asp file and it needs to be precessed before sending to the clients browser?
DocZaf
{;->
-
Feb 19th, 2001, 09:57 PM
#7
Addicted Member
Then I think you can do this:
Code:
Window.Navigate "http://test/myasp.asp"
-
Feb 19th, 2001, 10:47 PM
#8
Fanatic Member
Sorry, I dont think i explained myself properly.
I have code routines wriiten in asp which use to process requests for any documents on the site, and the routines would be applied to say 80% of the documents on the website.
I dont want to duplicate the code in EACH page I would rather pace the code in common document (in this case the frames page) and just execute it along with whatever parameters i pass.
It needs to be in asp as it connects to the access db and i'm not sure if i connect to the db if its in a .vbs file
Also when i did try on my pc, I found that if the page was .htm then the code gets executed and if its asp then it doesn't.
Something is wrong here or maybe i'm missing the point by a mile.
Alas.....
DocZaf
{;->
-
Feb 20th, 2001, 03:20 AM
#9
Retired VBF Adm1nistrator
By about 3 miles I suspect.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 20th, 2001, 05:20 AM
#10
Addicted Member
I think you can use .vbs files in asp script. Try this:
<script language = "VBScript" Runat="Server" Src="Functions.vbs">
</script>
I think it will work.
-
Feb 20th, 2001, 09:54 AM
#11
Frenzied Member
in answer to the original question:
parent.htm
Code:
<HTML>
<HEAD>
<Script language=javascript>
function f(x)
{
alert(x)
}
</script>
<TITLE></TITLE>
</HEAD>
<BODY>
<iframe src='child.htm'>
</iframe>
</BODY>
</HTML>
child.htm
Code:
<HTML>
<HEAD>
</HEAD>
<BODY>
<form>
<input type=button onclick='parent.f("hello from child.htm")'>
</form>
</BODY>
</HTML>
-
Feb 25th, 2001, 07:11 AM
#12
New Member
all what you have to do is:
<Script language = "VBScript">
Window.Parent.Frames("Top").FunctionName()
</script>
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
|