Hi,
I have a javascript file that I want to use on a button.
If I have the javascript file in the same folder as the webform then it
works for eg:
/SampleApp/WebForms/TestForm.aspx
but I want to try to read the javascript from another folder for e.g
/SampleApp/JScript/MyJavaScript.js
Here is my code:
if (!Page.IsClientScriptBlockRegistered("TestJavaScri pt"))
{
Page.RegisterClientScriptBlock("TestJavaScript", "<script
Language='JavaScript' src='MyJavaScriptFile.js'></script>");
"I want to change it to ---- src='~/JScript/MyJavaScriptFile.js'
}
btnRegisterClientScriptBlockJS.Attributes.Add("onc lick",
"ConfirmationWindow();");
It does not work if i change it to second option...
any advice.
Thanks,
Stephen 3 1296
On Oct 3, 6:39 pm, "stephen" <stephen...@hotmail.comwrote:
Hi,
I have a javascript file that I want to use on a button.
If I have the javascript file in the same folder as the webform then it
works for eg:
/SampleApp/WebForms/TestForm.aspx
but I want to try to read the javascript from another folder for e.g
/SampleApp/JScript/MyJavaScript.js
Here is my code:
if (!Page.IsClientScriptBlockRegistered("TestJavaScri pt"))
{
Page.RegisterClientScriptBlock("TestJavaScript", "<script
Language='JavaScript' src='MyJavaScriptFile.js'></script>");
"I want to change it to ---- src='~/JScript/MyJavaScriptFile.js'
}
btnRegisterClientScriptBlockJS.Attributes.Add("onc lick",
"ConfirmationWindow();");
It does not work if i change it to second option...
any advice.
Thanks,
Stephen
~ cannot be executed outside the ASP.NET
use src='/JScript/MyJavaScriptFile.js' or '../JScript/
MyJavaScriptFile.js'
Thanks Alexey,
the second option you suggested worked.
stephen
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11********************@y42g2000hsy.googlegrou ps.com...
On Oct 3, 6:39 pm, "stephen" <stephen...@hotmail.comwrote:
>Hi,
I have a javascript file that I want to use on a button.
If I have the javascript file in the same folder as the webform then it works for eg: /SampleApp/WebForms/TestForm.aspx
but I want to try to read the javascript from another folder for e.g /SampleApp/JScript/MyJavaScript.js
Here is my code: if (!Page.IsClientScriptBlockRegistered("TestJavaScri pt")) { Page.RegisterClientScriptBlock("TestJavaScript", "<script Language='JavaScript' src='MyJavaScriptFile.js'></script>");
"I want to change it to ---- src='~/JScript/MyJavaScriptFile.js'
}
btnRegisterClientScriptBlockJS.Attributes.Add("on click", "ConfirmationWindow();");
It does not work if i change it to second option... any advice. Thanks, Stephen
~ cannot be executed outside the ASP.NET
use src='/JScript/MyJavaScriptFile.js' or '../JScript/
MyJavaScriptFile.js'
On Oct 3, 7:16 pm, "stephen" <stephen...@hotmail.comwrote:
Thanks Alexey,
the second option you suggested worked.
stephen
"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message
news:11********************@y42g2000hsy.googlegrou ps.com...On Oct 3, 6:39 pm, "stephen" <stephen...@hotmail.comwrote:
Hi,
I have a javascript file that I want to use on a button.
If I have the javascript file in the same folder as the webform then it
works for eg:
/SampleApp/WebForms/TestForm.aspx
but I want to try to read the javascript from another folder for e.g
/SampleApp/JScript/MyJavaScript.js
Here is my code:
if (!Page.IsClientScriptBlockRegistered("TestJavaScri pt"))
{
Page.RegisterClientScriptBlock("TestJavaScript", "<script
Language='JavaScript' src='MyJavaScriptFile.js'></script>");
"I want to change it to ---- src='~/JScript/MyJavaScriptFile.js'
}
btnRegisterClientScriptBlockJS.Attributes.Add("onc lick",
"ConfirmationWindow();");
It does not work if i change it to second option...
any advice.
Thanks,
Stephen
~ cannot be executed outside the ASP.NET
use src='/JScript/MyJavaScriptFile.js' or '../JScript/
MyJavaScriptFile.js'
okay, it means that SampleApp is not a root directory, so the absolute
path must be src='/SampleApp/JScript/MyJavaScriptFile.js'
".." means parent directory (one level up in a relative path) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Eddie |
last post by:
When I use JavaScript to read an element's textDecoration style, I
only get one value even if there are more than one in the sytle sheet.
For example if the text-decoration is defined as:...
|
by: Cardman |
last post by:
Greetings,
I am trying to solve a problem that has been inflicting my self
created Order Forms for a long time, where the problem is that as I
cannot reproduce this error myself, then it is...
|
by: Roland Hall |
last post by:
I have two(2) issues.
I'm experiencing a little difficulty and having to resort to a work around.
I already found one bug, although stated the bug was only in ODBC, which I'm
not using. It...
|
by: Steve |
last post by:
OK, I know I can't read a file with JavaScript, but I see references
that I can use the filesystemobject which is part of vb script. Can I
embed vb script in HTML?
I am writing a program for...
|
by: ryanmhuc |
last post by:
I know the subject might be confusing. I am no beginner with
javascript but I haven't been able to figure out how to get the
javascript file name from code inside the file. So you have an HTML...
|
by: John Dann |
last post by:
I'm trying to read some binary data from a file created by another
program. I know the binary file format but can't change or control the
format. The binary data is organised such that it should...
|
by: RR |
last post by:
I'm trying to read an xml file into a dataset just like I do in my windows
application.
DataSet.ReadXML("filename.xml");
But no matter how I have the string file name the application errors...
|
by: John |
last post by:
How can I tell if a line begins with a number instead of a character? I need
to read a text file and some of the data begins with a character which is
causing me an issue in reading and uploading...
|
by: =?Utf-8?B?UGhpbCBKb2huc29u?= |
last post by:
Hi,
This is an issue that happens to me and everybody else I know and I've never
found a way around it.
In Visual Studio (currently using 2003 but the same has happened for me in
2005 and...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |