473,473 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Calling External Javascript

Hello all

I have 3 functions in a javacrip file (MyScript.js), which is added to an
ASP.NET 2.0 project

1) no right-click
2) no select text (copy...)
3) History.Back()'

How do I call those 3 functions in all of my pages?

TIA

Newbie Coder
Nov 23 '06 #1
5 3231
Hi,

Newbie Coder wrote:
Hello all

I have 3 functions in a javacrip file (MyScript.js), which is added to an
ASP.NET 2.0 project
To include an external script file in your ASPX page, use

<script type="text/javascript" src="myscript.js"></script>

Then you can use your functions as if they were included in the page itself.

1) no right-click
2) no select text (copy...)
3) History.Back()'
Are you aware, though, that any effort to prevent right click or to
prevent selecting text, or to control the user's navigation are doomed
to fail and to make you look like a JavaScript fool? :-)

You cannot prevent the user to look at your source code, or to copy text
or images. It's simply impossible. What you put on the web is for
everyone to see, and to use.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 24 '06 #2
Thank you for your reply, but I have tried that method & its not working for
me

I get errors on page

One function I am using I need to run onLoad

How can I achieve this?
"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

Newbie Coder wrote:
Hello all

I have 3 functions in a javacrip file (MyScript.js), which is added to
an
ASP.NET 2.0 project

To include an external script file in your ASPX page, use

<script type="text/javascript" src="myscript.js"></script>

Then you can use your functions as if they were included in the page
itself.
>
1) no right-click
2) no select text (copy...)
3) History.Back()'

Are you aware, though, that any effort to prevent right click or to
prevent selecting text, or to control the user's navigation are doomed
to fail and to make you look like a JavaScript fool? :-)

You cannot prevent the user to look at your source code, or to copy text
or images. It's simply impossible. What you put on the web is for
everyone to see, and to use.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Nov 24 '06 #3
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:Od****************@TK2MSFTNGP06.phx.gbl...
Thank you for your reply, but I have tried that method & its not working
for
me

I get errors on page
IF YOU DON'T SAY WHAT ERRORS YOU ARE GETTING, HOW DO YOU EXPECT ANYONE TO
HELP YOU???
I also wrote some JavaScript this morning but it's not working - I'm getting
errors on the page - can you fix it, please...?
Nov 24 '06 #4
Mark

You have an attitude problem I think. I saw this in another post in this
forum

Errors:

Sometimes I get:

Line 20 = <script>
Char 5 = P (see above)
Error: Object Expected
Code: 0
URL: [The page calling the external code]

Line 39 = <TR>
Char 1 = <
Error: Syntax Error
Code: 0
URL: [The page calling the external code]

Line defining Javascript file:

<script type="text/javascript" src="MyScript.js"></script>
<script language="javascript">

MyFunctionNameHere();

</script>


"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:Oo**************@TK2MSFTNGP04.phx.gbl...
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:Od****************@TK2MSFTNGP06.phx.gbl...
Thank you for your reply, but I have tried that method & its not working
for
me

I get errors on page

IF YOU DON'T SAY WHAT ERRORS YOU ARE GETTING, HOW DO YOU EXPECT ANYONE TO
HELP YOU???
I also wrote some JavaScript this morning but it's not working - I'm
getting
errors on the page - can you fix it, please...?


Nov 24 '06 #5
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:ua**************@TK2MSFTNGP02.phx.gbl...
You have an attitude problem I think.
Yeah, that must be what it is...
I saw this in another post in this forum
More than one, surely... :-)
Errors:

Sometimes I get:

Line 20 = <script>
Char 5 = P (see above)
Error: Object Expected
Code: 0
URL: [The page calling the external code]

Line 39 = <TR>
Char 1 = <
Error: Syntax Error
Code: 0
URL: [The page calling the external code]

Line defining Javascript file:

<script type="text/javascript" src="MyScript.js"></script>
<script language="javascript">

MyFunctionNameHere();

</script>
There you go! If you'd posted the above in the first place we wouldn't be
having this conversation because I can now see exactly what the problem is
and, more importantly, how to fix it.
Nov 24 '06 #6

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

Similar topics

4
by: Smoke | last post by:
We had a javascript calling a Cold Fusion page (.cfm) and it was working for 2 years. Suddenly yesterday or today its decided it doesn't want to work anymore. I'm picking up somebody elses code I...
1
by: Ian Sedwell | last post by:
Hi guys Many thanks to all who replied to my original question. Actually, it's dead easy and the way I was doing it was correct the first time. You do indeed simply call the VBScript routine...
11
by: Jake j | last post by:
Yes, this is a simple and straightforward thing to do as long as the .js file doesn't use a function. When I try a script with a function in a js file I can't get it to work (though it works fine...
2
by: korund | last post by:
<html> <head> <title>Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> function init() { alert('Message 1');...
4
by: Adam Smith | last post by:
Hello, How can I call or trigger an external javascript twice in a form? I have <script language="JavaScript" src="country_state.js" name="Country_State"> <script type="text/javascript"...
1
by: msraog | last post by:
Hi, Iam getting an error while calling a function which is declared in the external javascript file jsp file:- ------------------- <SCRIPT language='JavaScript1.1' src='includes/common.js>...
5
by: Shereef | last post by:
Hi All, I need to call an external application from my javascript and that external appn(c or c++) should give an html page back to me and i need to produce that new html page to the user. will...
2
by: Debbie | last post by:
I have always used VBScript but now need to convert my syntax to JavaScript. In an external file, I have a function that is called when a user clicks a button on a login page. The function checks...
0
Oralloy
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,...
0
jinu1996
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.