Doing <body onload="something()"> in ASP.Net

B

Bob Delaney

I use some older JavaScript in classic ASP pages. I'm trying to migrate
these pages to ASP.Net. I am using a Master Page.
To operate a slide show routine written in JavaScript, I have, in the
classic ASP pages, used an onload event, like this:
<body onload=routineName()>
Is there some way to do this using a Master Page in ASP.Net?
Bob Delaney
 
J

Justin Dutoit

The body tag is in the master page, not the 'content' pages, so you can put
it in there like before. Using <body onload="dothis()"> is not really
outdated in ASP.NET.

BTW I recommend looking at www.asp.net and click on Learn, to learn about
ASP.NET, and get a good Wrox book on the subject.

HTH,
Justin Dutoit
 
A

Andrew Morton

Bob said:
I use some older JavaScript in classic ASP pages. I'm trying to
migrate these pages to ASP.Net. I am using a Master Page.
To operate a slide show routine written in JavaScript, I have, in
the classic ASP pages, used an onload event, like this:
<body onload=routineName()>
Is there some way to do this using a Master Page in ASP.Net?
Bob Delaney

Presumably you're wanting to do something different in each page, so rather
than using onload in the <body> tag, you can add the function with a bit of
JavaScript:

<script type="text/javascript">
//<![CDATA[
function doSomething() {
/* do something */
};
window.onload = doSomething;
//]]>
</script>

HTH

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top