473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

javascript function parameter problem

function openWindow(name, path, w, h) {

OpenWindow=window.open( path,name,...

Works if I call it with path parameter equal to

'Images/Mass1.jpg'

but not if it is equal to

'~/Images/Mass1.jpg'

after I move the calling program to a subfolder

What am I doing wrong?

Thanks


Oct 4 '08 #1
3 955
the "~" support (unlike unix based webservers) is supplied by asp.net
server controls that have a url property. you can either use a relative
url (../images) or user server code to determine the correct path and
write out to the javascript.

-- bruce (sqlwork.com)

AAaron123 wrote:
function openWindow(name, path, w, h) {

OpenWindow=window.open( path,name,...

Works if I call it with path parameter equal to

'Images/Mass1.jpg'

but not if it is equal to

'~/Images/Mass1.jpg'

after I move the calling program to a subfolder

What am I doing wrong?

Thanks

Oct 4 '08 #2
"AAaron123" <aa*******@roadrunner.comwrote in message
news:Oc**************@TK2MSFTNGP02.phx.gbl...
What am I doing wrong?
As Bruce says, the tilde character is ASP.NET shorthand for 'root
directory' - it has no meaning to client-side JavaScript...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 4 '08 #3
Thanks to you both for clearing up the meaning of ~.
I had also tried ".." before my NG post.

The problem was that function openWindow was in a file that I didn't move to
the subfolder. It was that, not the images, that couldn't be found.

Thanks again

"AAaron123" <aa*******@roadrunner.comwrote in message
news:Oc**************@TK2MSFTNGP02.phx.gbl...
function openWindow(name, path, w, h) {

OpenWindow=window.open( path,name,...

Works if I call it with path parameter equal to

'Images/Mass1.jpg'

but not if it is equal to

'~/Images/Mass1.jpg'

after I move the calling program to a subfolder

What am I doing wrong?

Thanks


Oct 4 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Venkat | last post by:
Hi All, I know that this is not right forum to address this issue, i had posted this problem in Javascript forum but of no use, i appreciate if any one of you can answer or point me to some...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
3
by: willyWEB66 | last post by:
Hi everyone, I'm having problem with the sequence of execution for xml.onload. It works fine if your not passing parameters to onload event but my code needs to pass parameter to its function. I'm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.