Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Setting top.someFrame.location...

Reply
Thread Tools

Setting top.someFrame.location...

 
 
hzgt9b
Guest
Posts: n/a
 
      02-14-2008
Using VS2005, VB.NET and lots of javascript,
I have a page with (gasp) frames on it. It has two frames a navigation
pane and a "content" pane. The navigation pane runs a page that has
lots of javascript in it. One of the scripts controls what is
dispalyed in the content pane. I am using the following code to
navigate the content pane to a url:

top.content.location=targetUrl;

This works great most of the time but sometimes I have trouble opening
pages with relative paths. How can I specify a path (i.e. targetUrl)
that always point to the same folder in my site?


PS - Frames: I am stuck with them for now - would love to get rid them
but I'm not in a position todo so right now - more discussion
regarding them is moot point regarding this post

Your thoughts appreciated.
 
Reply With Quote
 
 
 
 
SAM
Guest
Posts: n/a
 
      02-14-2008
hzgt9b a écrit :
> Using VS2005, VB.NET and lots of javascript,
> I have a page with (gasp) frames on it. It has two frames a navigation
> pane and a "content" pane. The navigation pane runs a page that has
> lots of javascript in it. One of the scripts controls what is
> dispalyed in the content pane. I am using the following code to
> navigate the content pane to a url:
>
> top.content.location=targetUrl;
>
> This works great most of the time but sometimes I have trouble opening
> pages with relative paths. How can I specify a path (i.e. targetUrl)
> that always point to the same folder in my site?


It is a simple html question ...

In the head of the menu's page (very close to top) :

<base href="mySite/myFolder/myPages/">

or if you want to send all pages in the same frame

<base href="mySite/myFolder/myPages/" target="content">

and your menu's links :

<a href="p1.htm">page 1</a>



About your JavaScript :

<a href="../../aPage.htm"
onclick="top.content.location=this.href;return false;">a page</a>


--
sm
 
Reply With Quote
 
 
 
 
hzgt9b
Guest
Posts: n/a
 
      02-15-2008
On Feb 14, 6:58 pm, SAM <(E-Mail Removed)>
wrote:
> hzgt9b a écrit :
>
> > Using VS2005, VB.NET and lots of java script,
> > I have a page with (gasp) frames on it. It has two frames a navigation
> > pane and a "content" pane. The navigation pane runs a page that has
> > lots of java script in it. One of the scripts controls what is
> > dispalyed in the content pane. I am using the following code to
> > navigate the content pane to a url:

>
> > top.content.location=targetUrl;

>
> > This works great most of the time but sometimes I have trouble opening
> > pages with relative paths. How can I specify a path (i.e. targetUrl)
> > that always point to the same folder in my site?

>
> It is a simple html question ...
>
> In the head of the menu's page (very close to top) :
>
> <base href="mySite/myFolder/myPages/">
>
> or if you want to send all pages in the same frame
>
> <base href="mySite/myFolder/myPages/" target="content">
>
> and your menu's links :
>
> <a href="p1.htm">page 1</a>
>
> About your JavaScript :
>
> <a href="../../aPage.htm"
> onclick="top.content.location=this.href;return false;">a page</a>
>
> --
> sm


Well, I don't actually have any links in the navigation pane itself -
its all java script logic. The only place the url exists is in the
java script "targetUrl".

Regardless, I need to know how java script sees the relative folders
in my site. Let me give you a little more detail on the problem I am
experiencing - I'll start by giving you a little tour of my site's
structure:

/
Default.aspx
Default.aspx.vb
web.config

/myApp1/
frame.aspx - defines the two frames: navigation (opens
navigation.aspx) & content (opens viewDocument.aspx)
viewDocument.aspx - page that is opened in the content pane -
this page accepts the targetUrl from the navigation query string
navigation.aspx - navigation frame - div onclick's trigger java
script to execute "top.content.location=targetUrl;"
NOTE: The targetUrl is always in the format:
"viewDocument.aspx?targetUrl=<some web page, local or on the web>"
where the page in the targetUrl string is always in the same folder as
navigation.aspx

/myApp1/localContent/

/myApp1/localContent/content1/
page1.html
page2.html, etc.

/myApp1/localContent/content1/page1_files/
page1Resource.htm
page1Resource.jpg
page1Resource.xml, etc.

/myApp1/localContent/content2/page2_files/
page2Resource.htm
page2Resource.jpg
page2Resource.xml, etc.



So, what happens is that my site opens to the frame.aspx page.
frame.aspx opens navigation.aspx in one frame and when the user clicks
on objects (DIV's) in the navigation page the following java script
runs to populate the content mane with data:

top.content.location=targetUrl;


The problem I am having is that when I click on my "page1" div,
targetUrl looks like this: "viewDocument.aspx?targetUrl=localContent/
content1/page1.html" but I get the following error:

The file '/myApp1/localContent/content1/page1_files/
viewDocument.aspx' does not exist.


The app is looking for viewDocument.aspx in the wrong folder... what I
don't understand is how the page and/or java script keeps track of the
current directory of the site. Can someone shed some light on this
subject and give me an explanation as to why I am getting the error
above?
 
Reply With Quote
 
hzgt9b
Guest
Posts: n/a
 
      02-15-2008
On Feb 15, 10:23*am, hzgt9b <(E-Mail Removed)> wrote:
> On Feb 14, 6:58 pm, SAM <(E-Mail Removed)>
> wrote:
>
>
>
>
>
> > hzgt9b a écrit :

>
> > > Using VS2005, VB.NET and lots of java script,
> > > I have a page with (gasp) frames on it. It has two frames a navigation
> > > pane and a "content" pane. The navigation pane runs a page that has
> > > lots of java script in it. One of the scripts controls what is
> > > dispalyed in the content pane. I am using the following code to
> > > navigate the content pane to a url:

>
> > > * * * top.content.location=targetUrl;

>
> > > This works great most of the time but sometimes I have trouble opening
> > > pages with relative paths. How can I specify a path (i.e. targetUrl)
> > > that always point to the same folder in my site?

>
> > It is a simple html question ...

>
> > In the head of the menu's page (very close to top) :

>
> > * * *<base href="mySite/myFolder/myPages/">

>
> > or if you want to send all pages in the same frame

>
> > * * *<base href="mySite/myFolder/myPages/" target="content">

>
> > and your menu's links :

>
> > * * *<a href="p1.htm">page 1</a>

>
> > About your JavaScript :

>
> > <a href="../../aPage.htm"
> > * * onclick="top.content.location=this.href;return false;">a page</a>

>
> > --
> > sm

>
> Well, I don't actually have any links in the navigation pane itself -
> its all java script logic. The only place the url exists is in the
> java script "targetUrl".
>
> Regardless, I need to know how java script sees the relative folders
> in my site. Let me give you a little more detail on the problem I am
> experiencing - I'll start by giving you a little tour of my site's
> structure:
>
> * */
> * * * Default.aspx
> * * * Default.aspx.vb
> * * * web.config
>
> * */myApp1/
> * * * frame.aspx - defines the two frames: navigation (opens
> navigation.aspx) & content (opens viewDocument.aspx)
> * * * viewDocument.aspx - page that is opened in the content pane -
> this page accepts the targetUrl from the navigation query string
> * * * navigation.aspx - navigation frame - div onclick's trigger java
> script to execute "top.content.location=targetUrl;"
> * * * * * * NOTE: The targetUrl is always in the format:
> "viewDocument.aspx?targetUrl=<some web page, local or on the web>"
> where the page in the targetUrl string is always in the same folder as
> navigation.aspx
>
> * */myApp1/localContent/
>
> * */myApp1/localContent/content1/
> * * * page1.html
> * * * page2.html, etc.
>
> * */myApp1/localContent/content1/page1_files/
> * * * page1Resource.htm
> * * * page1Resource.jpg
> * * * page1Resource.xml, etc.
>
> * */myApp1/localContent/content2/page2_files/
> * * * page2Resource.htm
> * * * page2Resource.jpg
> * * * page2Resource.xml, etc.
>
> So, what happens is that my site opens to the frame.aspx page.
> frame.aspx opens navigation.aspx in one frame and when the user clicks
> on objects (DIV's) in the navigation page the following java script
> runs to populate the content mane with data:
>
> * *top.content.location=targetUrl;
>
> The problem I am having is that when I click on my "page1" div,
> targetUrl looks like this: "viewDocument.aspx?targetUrl=localContent/
> content1/page1.html" but I get the following error:
>
> * *The file '/myApp1/localContent/content1/page1_files/
> viewDocument.aspx' does not exist.
>
> The app is looking for viewDocument.aspx in the wrong folder... what I
> don't understand is how the page and/or java script keeps track of the
> current directory of the site. Can someone shed some light on this
> subject and give me an explanation as to why I am getting the error
> above?- Hide quoted text -
>
> - Show quoted text -


Forgot to add this - I get they error above when navigating to page1,
but when I navigate to page2 everything works correctly (i.e. the web
app looks for viewDocument.aspx in the correct folder (i.e. '/myApp/')
 
Reply With Quote
 
hzgt9b
Guest
Posts: n/a
 
      02-16-2008
On Feb 15, 10:40*am, hzgt9b <(E-Mail Removed)> wrote:
> On Feb 15, 10:23*am, hzgt9b <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On Feb 14, 6:58 pm, SAM <(E-Mail Removed)>
> > wrote:

>
> > > hzgt9b a écrit :

>
> > > > Using VS2005, VB.NET and lots of java script,
> > > > I have a page with (gasp) frames on it. It has two frames a navigation
> > > > pane and a "content" pane. The navigation pane runs a page that has
> > > > lots of java script in it. One of the scripts controls what is
> > > > dispalyed in the content pane. I am using the following code to
> > > > navigate the content pane to a url:

>
> > > > * * * top.content.location=targetUrl;

>
> > > > This works great most of the time but sometimes I have trouble opening
> > > > pages with relative paths. How can I specify a path (i.e. targetUrl)
> > > > that always point to the same folder in my site?

>
> > > It is a simple html question ...

>
> > > In the head of the menu's page (very close to top) :

>
> > > * * *<base href="mySite/myFolder/myPages/">

>
> > > or if you want to send all pages in the same frame

>
> > > * * *<base href="mySite/myFolder/myPages/" target="content">

>
> > > and your menu's links :

>
> > > * * *<a href="p1.htm">page 1</a>

>
> > > About your JavaScript :

>
> > > <a href="../../aPage.htm"
> > > * * onclick="top.content.location=this.href;return false;">a page</a>

>
> > > --
> > > sm

>
> > Well, I don't actually have any links in the navigation pane itself -
> > its all java script logic. The only place the url exists is in the
> > java script "targetUrl".

>
> > Regardless, I need to know how java script sees the relative folders
> > in my site. Let me give you a little more detail on the problem I am
> > experiencing - I'll start by giving you a little tour of my site's
> > structure:

>
> > * */
> > * * * Default.aspx
> > * * * Default.aspx.vb
> > * * * web.config

>
> > * */myApp1/
> > * * * frame.aspx - defines the two frames: navigation (opens
> > navigation.aspx) & content (opens viewDocument.aspx)
> > * * * viewDocument.aspx - page that is opened in the content pane -
> > this page accepts the targetUrl from the navigation query string
> > * * * navigation.aspx - navigation frame - div onclick's trigger java
> > script to execute "top.content.location=targetUrl;"
> > * * * * * * NOTE: The targetUrl is always in the format:
> > "viewDocument.aspx?targetUrl=<some web page, local or on the web>"
> > where the page in the targetUrl string is always in the same folder as
> > navigation.aspx

>
> > * */myApp1/localContent/

>
> > * */myApp1/localContent/content1/
> > * * * page1.html
> > * * * page2.html, etc.

>
> > * */myApp1/localContent/content1/page1_files/
> > * * * page1Resource.htm
> > * * * page1Resource.jpg
> > * * * page1Resource.xml, etc.

>
> > * */myApp1/localContent/content2/page2_files/
> > * * * page2Resource.htm
> > * * * page2Resource.jpg
> > * * * page2Resource.xml, etc.

>
> > So, what happens is that my site opens to the frame.aspx page.
> > frame.aspx opens navigation.aspx in one frame and when the user clicks
> > on objects (DIV's) in the navigation page the following java script
> > runs to populate the content mane with data:

>
> > * *top.content.location=targetUrl;

>
> > The problem I am having is that when I click on my "page1" div,
> > targetUrl looks like this: "viewDocument.aspx?targetUrl=localContent/
> > content1/page1.html" but I get the following error:

>
> > * *The file '/myApp1/localContent/content1/page1_files/
> > viewDocument.aspx' does not exist.

>
> > The app is looking for viewDocument.aspx in the wrong folder... what I
> > don't understand is how the page and/or java script keeps track of the
> > current directory of the site. Can someone shed some light on this
> > subject and give me an explanation as to why I am getting the error
> > above?- Hide quoted text -

>
> > - Show quoted text -

>
> Forgot to add this - I get they error above when navigating to page1,
> but when I navigate to page2 everything works correctly (i.e. the web
> app looks for viewDocument.aspx in the correct folder (i.e. '/myApp/')- Hide quoted text -
>
> - Show quoted text -


anyone?
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      02-17-2008
hzgt9b wrote:
> Using VS2005, VB.NET


Irrelevant.

> and lots of javascript, I have a page with (gasp) frames on it. It has
> two frames a navigation pane and a "content" pane. The navigation pane
> runs a page that has lots of javascript in it. One of the scripts
> controls what is dispalyed in the content pane. I am using the following
> code to navigate the content pane to a url:
>
> top.content.location=targetUrl;


Should be

window.top.frames["content"].location = targetUrl;

> This works great most of the time but sometimes I have trouble opening
> pages with relative paths. How can I specify a path (i.e. targetUrl) that
> always point to the same folder in my site?


Parse error.

> [...] Your thoughts appreciated.


You should take heed of the FAQ, especially the part about proper
posting if you want to have any chance of helpful replies.

http://jibbering.com/faq/


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting Onclick and setting the ClientID in behind code isn't working in Mozilla davidr@sharpesoft.com ASP .Net 2 08-22-2006 09:30 PM
setting Onclick and setting the ClientID in behind code isn't working in Mozilla davidr@sharpesoft.com ASP .Net 0 08-21-2006 11:55 PM
python-dev and setting up setting up f2py on Windows XP Sile Python 5 08-18-2006 08:13 AM
tomcat 4.x : setting mime type for a directory or setting a default mime type CJ Java 1 10-29-2004 07:51 PM
Setting a configurable time-out setting for all the communication initiated with Remoting object. Srinivasa Raghavan Sethuraman ASP .Net 0 06-30-2004 10:05 AM



Advertisments