Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2004, 09:53 AM
Authorized User
 
Join Date: Oct 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Button problem

I have file called "main.aspx" with this code:

<frameset border="0" frameSpacing="0" frameBorder="no" cols="97,87%">

<frame name="menue" src="left.aspx" noResize scrolling="auto" target="main">

<frame name="main" src="right.aspx">



In "left.aspx" (The menue) I have a botton. I want that click on it will open the file "Home.aspx" in the right frame (called "main")!!!

In "left.aspx.vb" I have this code but it's dont work.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Page.RegisterClientScriptBlock("Home", "<script language='javascript'>document.frames['main'].src='Home.aspx';</script>")

End Sub


What's the problem and how to fix it?
 
Old November 10th, 2004, 10:05 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

(I moved this thread to a more appropriate forum.)

The name "document" refers to the window the javascript is running in. You need to back up to the browser window to get at the main frame:

top.frames['main']...

or

window.parent.frames['main']

You should also be able to access with the name "main":

window.parent.main
 
Old November 18th, 2004, 08:27 AM
Authorized User
 
Join Date: Oct 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I wrote this:

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Page.RegisterClientScriptBlock("home", "<script language='javascript'>window.parent.frames['main'].src='Home.aspx';</script>")

 End Sub


But still not work!
What to do??






Similar Threads
Thread Thread Starter Forum Replies Last Post
Button OnClick problem john6630 ASP.NET 2.0 Basics 2 September 21st, 2007 05:44 PM
Problem with the Back button aldwinenriquez Classic ASP Basics 2 June 24th, 2005 01:53 AM
Button problem liorlankri ASP.NET 1.x and 2.0 Application Design 1 November 11th, 2004 09:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.