codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Automatically Run a code on every page  bmcua at 11:39 on Friday, December 17, 2004
 

Hi,

I want to run a code everytime the page is loaded.
so everytime the user view the page. I would run a code that will log some data or do something.

One way is to insert the function in the Page_Load(), but I don't want to put it on every page.

Is this possible?

Thanks


  Re: Automatically Run a code on every page  tgreer at 14:20 on Friday, December 17, 2004
 

You're posting in the C++ forum, but I suspect you're writing C# ASP.NET code. Is the right?

If so, look at the Page.RegisterStartupScript() method, to assign a JavaScript function to run client-side when the page loads.

Of course, you could just as easily do this with the JavaScript onload event handler in the body tag.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007