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 javascript that works fine until I
try to separate the script into a .js file. I've found that only the script
that is called from events set in the aspx.cs file don't work. I eliminated
all script except two functions. One is used with the .cs file and the
other one is not.
First, here's the functino used with the .cs file:
if (!this.IsPostBa ck)
{
btnFirst.OnClie ntClick = "return btnFirst_Click( )";
}
.... the javascript function is...
function btnFirst_Click( )
{
alert("This is btnFirst_Click" ):
return false;
}
Now the second javascript function is only
function ShowAlert()
{
alert("This is ShowAlert");
return false;
}
This function is called from another button - button1 - from the
OnClientClick event which I set in the property page..
When I have all the javascript in the aspx page, it all wokrs, but when I
move it to a .js file, the first function doesn't work, but the second one
does.
I don't want to add all my javascript in rhe .cs file because that would
expose all my code - that's why I'm teying to put it in a .js file.
How can I make all the code work using both methods?
Thanks...
--
Matthew.Wells
Ma***********@F irstByte.net