Re: Sometime the JavaScript function becomes undefined

Tech-Archive recommends: Fix windows errors by optimizing your registry



Since your last post I've been looking for my log file.
I find I am running IIS 5.1 and see that IIS 7 is around.
Is 5.1 OK for XP Pro?

I searched for all IIS files on my machine and no log showed up.
Following some Internet information I right clicked my website in IIS and
looked for the web tab but there isn't one.
So I haven't yet found the log file. I did want to check as you suggested
last time.


"Patrice" <http://www.chez.com/scribe/> wrote in message
news:401C6DA2-A2CF-4022-A9C6-19453A69AE97@xxxxxxxxxxxxxxxx
Is your web application at the root of your web site ?

In vs2008 under Solution Explorer there is the solution and under that 3
projects.
Directly under one of them is the Default.aspx, web.config and Global.asax
files.
And the root is the last folder in that project title?
This is the folder that show in IIS properties for this site.
I'm not sure what defines the application but the above sounds like the
answer is yes.
Agree?



If your web application is the web site root you'll have to use
src="/MySubFolder/JavaScripts/OpenWindow.js".
But (I hate saying "but") MySubFolder will be different on my machine and a
host's machine - won't it?

Thanks for sticking with this



IMO your best best is to check the IIS log as you'll see what is requested
and if the file is found or not...

--
Patrice


"AAaron123" <aaaron123@xxxxxxxxxxxxxx> a écrit dans le message de groupe
de discussion : efEViampJHA.996@xxxxxxxxxxxxxxxxxxxxxxx
If I do this in the master
<script type="text/javascript" src="/JavaScripts/OpenWindow.js"></script>

and this in the master

<a href="JavaScript:openWindow('Aerial','Ima

I always get openWindow is undefined.



I don't think I'll have a problem adjusting the Images folder

but I don't know why it doesn't find openWindow.



Thanks a lot

ps
Without the leading slash it works ok from Default.aspx which is in the
root with the master



"Patrice" <http://www.chez.com/scribe/> wrote in message
news:D8EF6F84-865A-4ACD-8471-7AD4B434E39A@xxxxxxxxxxxxxxxx
src="MyFolder" means the folder that is under the current page location.
src="/MyFolder" points to a folder to is under the root.
The master page doesn't play any role here. This is not a separate page.
Its content is just merged with the current page (much like a user
control).

You can also check this using the IIS log. You should see that your app
ask for a js file that doesn't exists...

So you'll have to adjust the js file name. You'll have also the same
problem for the Images folder....

The problem is that you are using relative paths so it depends where you
are and works only when you are at the root of your site. You should add
a leading / to use absolute paths...

--
Patrice

"AAaron123" <aaaron123@xxxxxxxxxxxxxx> a écrit dans le message de groupe
de discussion : #sMvE9lpJHA.5280@xxxxxxxxxxxxxxxxxxxxxxx
I typed JavaScript in the site map below when I should have written
JavaScripts. I revised it.
JavaScripts is at the root level. Your suggestion did not work probably
because of my typo.

So it works when the page's .aspx is at root but not when the page is
in a subfolder.

When a master is merged with a contents page I think all the file
descriptions are adjusted.

1)Right?

However, I'd guess that the quoted string containing openWindow would
not be adjusted.
<a href="JavaScript:openWindow('Aerial','Images/Aer..snip..

2)Right?

Maybe it doesn't need to be "adjusted" because it's in some global
namespace?

3)Comment?


Thanks


"Patrice" <http://www.chez.com/scribe/> wrote in message
news:326BA36B-EC34-4D73-B6FC-8A60BADE73EE@xxxxxxxxxxxxxxxx
src="JavaScripts/OpenWindows.js"

So the script must in a folder that is called JavaScripts and that is
in the same folder than the current ASPX page.


See site map below. JavaScripts is in the root folder.

The anchor calling openWindows is in the master.

It work OK if the contents page is at root level but not with a
contents page that is in a subfolder.

I hope this makes more sense to you than it does to me.

Any suggestions?


You may want to try src="/JavaScripts/OpenWindows.js" so that it takes
the folder that is named JavaScripts and is at the root of the web
site...

--
Patrice

"AAaron123" <aaaron123@xxxxxxxxxxxxxx> a écrit dans le message de
groupe de discussion : uyB0H3kpJHA.500@xxxxxxxxxxxxxxxxxxxxxxx
In the master header I have
<script type="text/javascript"
src="JavaScripts\OpenWindow.js"></script>

OpenWindow.js contains the function openWindow



In the body of the master I have

<a href="JavaScript:openWindow('Aerial','Images/Aer..snip



When I click the anchor while the page showing is Default.aspx (which
is at the root level as is .Master) the window opens OK.

The folder JavaScripts is also at the root level and OpenWindow.js
then one level below the root.

If instead of showing Default.aspx which is at the root level I show
the page Articles/Articles.aspx I find openWindow is undefined when I
click the anchor.

Do you see what is wrong?

Thanks



project

Default.aspx

Main.Master

JavaScripts(folder)

OpenWindow.js (contains function openWindow)

Articles(folder)

Articles.aspx

















.



Relevant Pages

  • Re: Anyone Familiar With Samba?
    ... If the application isolation settings on the folder containing the web ... IUSR_computername account. ... and also a copy of the password is cached in the IIS metabase [and both ... > use a Samba share from my Linux server as its web root. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Default app?
    ... Yes, there is, but for *any* page served by IIS, not just for pages served by ASP.NET. ... But the site at its root is not configured as a .net 'application' either ... if -as you say- it resides in the web-doc root folder. ... No extra configuration is needed. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Virtual Directory, Paths, Local and Deployed Problem
    ... The fact that IIS limits me to setting up only one site means that I ... It only knows the website root. ... > If you are looking to get to the /images folder from the root. ... Now deploy it to production. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Virtual Directory, Paths, Local and Deployed Problem
    ... If you are looking to get to the /images folder from the root. ... In production: http://www.site1.com/images/mygif.gif ... make this a virtual folder in IIS. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Sometime the JavaScript function becomes undefined
    ... Can't I capture that folder name and store it in a session variable? ... application is the web site root you'll have to use ... and this in the master ... I always get openWindow is undefined. ...
    (microsoft.public.dotnet.framework.aspnet)