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

Home Posts Topics Members FAQ

Javastript file still won't work...

Hello. This is a repost because nothing has worked so far.

I thought this was supposed to be simple. I'm trying to use a .js file for
my javascript functions. I'm testing by only using one function The
function works when it's at the top of my aspx file.

The file is called "MyFunctions.js" which was imported on the page load
event of the code-behind form with:
Page.ClientScript.RegisterClientScriptBlock(this.G etType(), "MyFuncs",
"MyFunctions.js", true); - I've used this with both true and false and with
adding script tags myself in the .js file.

I've also tried
Page.ClientScript.RegisterClientScriptInclude(this .GetType(), "MyFuncs",
"MyFunctions.js");

The .js file is in the same directory as the page. and has only one
function:

function SayHello()
{
alert("Hello");
}

I added the function call on the code behind page load

btnLast.Attributes.Add("onclick", "SayHello()");

is there supposed to be some directive in the .js file?

I've also tried just directly referencing the file in the aspx file with:
<script type="text/javascript" src="MyFunctions.js"></script>
Still no luck.

Any ideas? This is STILL driving me nuts!!!

Thanks.

Matthew Wells
Ma***********@FirstByte.net
Mar 2 '08 #1
2 1035
Hello Matthew,

Have u tried to use ClientScriptManager.RegisterStartupScript ?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
MWHello. This is a repost because nothing has worked so far.
MW>
MWI thought this was supposed to be simple. I'm trying to use a .js
MWfile for my javascript functions. I'm testing by only using one
MWfunction The function works when it's at the top of my aspx file.
MW>
MWThe file is called "MyFunctions.js" which was imported on the page
MWload event of the code-behind form with:
MWPage.ClientScript.RegisterClientScriptBlock(this .GetType(),
MW"MyFuncs", "MyFunctions.js", true); - I've used this with both true
MWand false and with adding script tags myself in the .js file.
MW>
MWI've also tried
MWPage.ClientScript.RegisterClientScriptInclude(th is.GetType(),
MW"MyFuncs", "MyFunctions.js");
MW>
MWThe .js file is in the same directory as the page. and has only one
MWfunction:
MW>
MWfunction SayHello()
MW{
MWalert("Hello");
MW}
MWI added the function call on the code behind page load
MW>
MWbtnLast.Attributes.Add("onclick", "SayHello()");
MW>
MWis there supposed to be some directive in the .js file?
MW>
MWI've also tried just directly referencing the file in the aspx file
MWwith:
MW<script type="text/javascript" src="MyFunctions.js"></script>
MWStill no luck.
MWAny ideas? This is STILL driving me nuts!!!
MW>
MWThanks.
MW>
MWMatthew Wells
MWMa***********@FirstByte.net
Mar 3 '08 #2
I'm trying it, but I can't seem to get the syntax down. Can you show me an
example?

Thanks.

Matthew Wells
Ma***********@FirstByte.net
"Michael Nemtsev [MVP]" <ne*****@msn.comwrote in message
news:90**************************@msnews.microsoft .com...
Hello Matthew,

Have u tried to use ClientScriptManager.RegisterStartupScript ?

---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

MWHello. This is a repost because nothing has worked so far.
MWMWI thought this was supposed to be simple. I'm trying to use a .js
MWfile for my javascript functions. I'm testing by only using one
MWfunction The function works when it's at the top of my aspx file.
MWMWThe file is called "MyFunctions.js" which was imported on the page
MWload event of the code-behind form with:
MWPage.ClientScript.RegisterClientScriptBlock(this .GetType(),
MW"MyFuncs", "MyFunctions.js", true); - I've used this with both true
MWand false and with adding script tags myself in the .js file.
MWMWI've also tried
MWPage.ClientScript.RegisterClientScriptInclude(th is.GetType(),
MW"MyFuncs", "MyFunctions.js");
MWMWThe .js file is in the same directory as the page. and has only
one
MWfunction:
MWMWfunction SayHello()
MW{
MWalert("Hello");
MW}
MWI added the function call on the code behind page load
MWMWbtnLast.Attributes.Add("onclick", "SayHello()");
MWMWis there supposed to be some directive in the .js file?
MWMWI've also tried just directly referencing the file in the aspx
file
MWwith:
MW<script type="text/javascript" src="MyFunctions.js"></script>
MWStill no luck.
MWAny ideas? This is STILL driving me nuts!!!
MWMWThanks.
MWMWMatthew Wells
MWMa***********@FirstByte.net


Mar 6 '08 #3

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

Similar topics

3
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in...
13
by: Bob Darlington | last post by:
I have a repair and backup database routine which runs when a user closes down my application. It works fine in my development machine, but breaks on a client's at the following line: If...
11
by: Bruce W...1 | last post by:
Would the code-behind and all ASP.NET functionality still work if the ..aspx files had instead .htm extensions? I suppose it boils down to whether the page directives would still work. Thanks...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
5
by: feng | last post by:
Hi, We just converted our VB.Net Windows exe project from VS.Net 2002 to VS.Net 2003 and ran into a problem. the MyApp.exe.config file that we use for our customized configuration settings is...
13
by: Ørjan Langbakk | last post by:
I wanna make a file that holds the complete pricelist for a small webshop (yes, I know that a database in the background would be a lot simpler, but that is not an option today, unfortunately). ...
9
by: JimmyKoolPantz | last post by:
IDE: Visual Studio 2005 Language: VB.NET Fox Pro Driver Version: 9.0.0.3504 Problem: I currently have a problem altering a DBF file. I do not get any syntax errors when running the program. ...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
2
by: Matthew Wells | last post by:
Hello. I'm reposting this because my prioe post's subject line was incorrect. I'm developing an asp.net 2.0 project using VS 2005 on XP sp2 with all the updates. I have an aspx page with...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...
0
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: 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 ...

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.