473,473 Members | 4,204 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

using java script along with ASP.NET language C#

1 New Member
I want to add .js file along with ASP.NET my code is:

Expand|Select|Wrap|Line Numbers
  1. Page.ClientScript.RegisterStartupScript(this.GetType(), "MyJavaScript",
  2.             "JScript1.js",true);
  3.  
  4. Button1.Attributes["onclick"] = "Alert()";
My .js file is:
Expand|Select|Wrap|Line Numbers
  1. function Alert() 
  2. {
  3.     alert('good morning');
  4. }
I have add:
Expand|Select|Wrap|Line Numbers
  1. <head runat="server">
  2.  <script language="javascript" src="JScript1.js" type="text/javascript"></script>
  3. </head>
That code was showing error:
JScript1.js is udefined

please help me
Feb 27 '12 #1
1 1398
Frinavale
9,735 Recognized Expert Moderator Expert
Since you have already added the JavaScript to the header of the file, you do not need to use the Page.ClientScript.RegisterStartupScript method.

Actually, that doesn't explain the error.
Do you have a file called "JScript1.js" in the same director as the page that is trying to access it?

I think your url to the JavaScript file is probably incorrect.

-Frinny
Feb 27 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Alen Hubtka | last post by:
Hello All, Can any one share the code to compare two date data using Java script?Please. I would like to compare two dates and findout there are greater than or less than each other. Thanks,...
3
by: Srinu | last post by:
How do i hide status bar in firefox using java script only Plz help me iam new to this group.
6
by: abdullah1983 | last post by:
Hi Guys, I need some clarification regarding the problem with safari browser. Please find my code below. I'm setting the image src, mouseover and mouseout using javascript. The mouseover and...
8
by: dbaplusplus | last post by:
I worked on web development using java script many many years, so I am now a newbie to javascript. I have a single html page, which is generated dynamically using some programming language. Web...
4
by: gsuns82 | last post by:
hi friends,can any one give the coding for finding file size using java script???
1
by: harshavardhan | last post by:
Hi, here is the problem: Consider there are three frames in a HTML page. When I try to print these frames using java script, only the third document is being printed thrice. <HTML><HEAD> <script...
7
by: kamalaswaminathan | last post by:
Hi all, I want to pass the value of the select box to another form using java script. my code looks like this.. <script> function func { document.myform.action = "abc.cgi";...
6
by: DhananjayPatki | last post by:
Hello, I wnat the code , how to disable the Close(x) icon script using java script . is there any event that can be used to prompt the user before closing the new window.
2
by: shashank narayan | last post by:
i m using a master page in my project and that page contains an image tag . i want to change images in that image tag by using java script after fixed time interval. my technology is asp.net. is it...
0
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.