Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Add attribute to Body

Reply
Thread Tools

Add attribute to Body

 
 
Roger
Guest
Posts: n/a
 
      02-06-2004
How do I add an onload attribute to the body of webpage dynamically?


 
Reply With Quote
 
 
 
 
Dan
Guest
Posts: n/a
 
      02-06-2004
Give the body tag an ID and Runat="server" property in your ASPX:

<body id="bodyHomePage" Runat="Server">

And then in your Page_Load do something like this:

bodyHomePage.Attributes.Add("onLoad", "alert('Welcome visitor')")

Dan


"Roger" <> wrote in message
news:...
> How do I add an onload attribute to the body of webpage dynamically?
>
>



 
Reply With Quote
 
 
 
 
Roger
Guest
Posts: n/a
 
      02-06-2004
thanks

"Dan" <> wrote in message
news:...
> Give the body tag an ID and Runat="server" property in your ASPX:
>
> <body id="bodyHomePage" Runat="Server">
>
> And then in your Page_Load do something like this:
>
> bodyHomePage.Attributes.Add("onLoad", "alert('Welcome visitor')")
>
> Dan
>
>
> "Roger" <> wrote in message
> news:...
> > How do I add an onload attribute to the body of webpage dynamically?
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
In the code behind: how to add a background attribute to the body tag. _Who ASP .Net 4 09-23-2008 08:41 PM
To reduce your body weight & slim your body Loss weight MCSA 0 07-21-2007 05:15 AM
Add body onload attribute from UserControl? John Kotuby ASP .Net 5 04-05-2007 01:29 AM
Add an attribute to the tag <body>? Mark Rae ASP .Net 1 10-31-2006 09:04 PM
Validation (XHTML 1.0 Transitional): Attribute 'leftmargin' is not a valid attribute of element 'body'. anonymous ASP .Net 1 08-02-2006 08:05 AM



Advertisments