Calling External Javascript

N

Newbie Coder

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
 
L

Laurent Bugnion

Hi,

Newbie said:
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
 
N

Newbie Coder

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?
 
M

Mark Rae

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...?
 
N

Newbie Coder

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>
 
M

Mark Rae

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top