crazyswede Posted November 20, 2012 Share Posted November 20, 2012 (edited) Here is my code. I had no trouble doing this in ‘C’. Is it possible in ASP?------------------------- tryfunction1.asp -------------<%@ Language=JavaScript %><HTML><HEAD> <TITLE>tryfunction1.asp</TITLE> </HEAD> <BODY bgColor= yellowleftMargin=5 text= black LINK= white VLINK= navy LINK= palegreen > <FONT size=2 FACE="Times New Roman"><%function myFunction( a, b ){Response.Write( "my function - "+ a + b +" <br>" );}a = "joe ";b = "was here. ";myFunction( a, b )a = "bill ";b = "was here. ";myFunction( a, b )a = "jill ";b = "was here. ";myFunction( a, b ) Response.Redirect( "tryfunction2.asp");//%> </BODY></HTML> ------------------------- tryfunction2.asp -------------<%@ Language=JavaScript %><HTML><HEAD> <TITLE>tryfunction2.asp</TITLE> </HEAD> <BODY bgColor= yellowleftMargin=5 text= black LINK= white VLINK= navy LINK= palegreen > <FONT size=2 FACE="Times New Roman"><%a = "tryfunction2";b = "was here. ";myFunction( a, b )a = "bill ";b = "was here. ";myFunction( a, b )a = "jill ";b = "was here. ";myFunction( a, b ) %> </BODY></HTML> ------------------------- ERROR MESSAGE ------------- Microsoft JScript runtime error '800a138f' Object expected /books/tryfunction2.asp, line 26 Edited November 20, 2012 by crazyswede Link to comment Share on other sites More sharing options...
justsomeguy Posted November 20, 2012 Share Posted November 20, 2012 Every page request by the browser is independent. Functions defined on one page are not defined in another page. You should define your functions in a common file, and then include that file on both pages. http://www.w3schools.com/asp/asp_incfiles.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now