473,569 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting <body> attributes

I want to set body attributes programmaticall y, from the module file:
I can go into the .aspx file and say <body onload="myFunc( )"> but I don't
want to.

Like you do with a textbox control:

txtCustomer.Att ributes("onblur ") = "myFunc()"

I would like to do the same with the <body> tag.

Any ideas?
Thanks

Nov 18 '05 #1
2 1800
You can assign a id and the runat="server" attribute to
the body tag and access it in your code as
HtmlGenericCont rol.

Tu-Thach
-----Original Message-----
I want to set body attributes programmaticall y, from the module file:I can go into the .aspx file and say <body onload="myFunc ()"> but I don'twant to.

Like you do with a textbox control:

txtCustomer.At tributes("onblu r") = "myFunc()"

I would like to do the same with the <body> tag.

Any ideas?
Thanks

.

Nov 18 '05 #2
if you run framework 1.1 you're in luck:

<body runat="server" id="body">

in code behind

HtmlGenericCont rol ctl = Page.FindContro l("body") as HtmlGenericCont rol;
if (ctl != null)
ctl.Attributes. Add("onclick"," alert('hi')");
-- bruce (sqlwork.com)
"James Cooke" <j-*************** ******@yahoo.co m> wrote in message
news:OZ******** ******@TK2MSFTN GP09.phx.gbl...
I want to set body attributes programmaticall y, from the module file:
I can go into the .aspx file and say <body onload="myFunc( )"> but I don't
want to.

Like you do with a textbox control:

txtCustomer.Att ributes("onblur ") = "myFunc()"

I would like to do the same with the <body> tag.

Any ideas?
Thanks


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2144
by: Andrés Giraldo | last post by:
Hi! It's possible to register some script between the <head> and </head> actually I'm Using RegisterStartupScript and RegisterClientBlockScript, but it works on the body By the way... how can I add an attribute to the <BODY> ? I need to assign a function on the onLoad attribute of the body... how
2
2029
by: ryan.mclean | last post by:
Hello everyone. Hope ya'll had a nice New Year. Anyway, my question is why won't this work? I must be doing something dumb . . . here is the code: in the body tag, I have this code (just to test): <script LANGUAGE="javascript"> <!-- function hiThere() { alert("hi");
3
2290
by: francescomoi | last post by:
Hi. I'm trying to insert some text between <head> and <body> but I'm not able. I try with: -------- bodyPoint = document.getElementsByTagName('body'); var myLink = document.createElement("a");
5
1602
by: SteveS | last post by:
Hello, I'm having trouble figuring out how to dynamically add an onload and resize event to the <body> tag. I've looked on the web and in MS documentation unsuccessfuly. Does anyone know the code to do this? The end result would be something like this: <body onload="MyFunction()" resize="ResizeFunction()"> Your help is greately...
0
1486
by: WB | last post by:
Hi, How can I add an "onbeforeunload" event to the body tag of the MasterPage? All pages in my site follow a MasterPage and some of these pages require long processing. I'd like to show a "Processing. Please wait" message for these pages and need to add an "onbeforeunload" event to the body tag like so: <body...
12
4904
by: Mark Rae | last post by:
Hi, It's easy enough for a child page to manipulate its MasterPage's header simply by modifying the MasterPage thus: <header runat="server"> .... .... </header>
8
2241
by: Prisoner at War | last post by:
Another weekend, another project, another problem.... Why should a perfectly fine function work only half-way through when called through onClick in an anchor tag?? The text fade-in script below works when called through onLoad in the <bodytag, but it "hangs" when called through onClick in <a href="#">, as follows: <script...
23
2217
by: Xah | last post by:
Here's a interesting case of invalid html 4 strict file. In summary, if you have <body></bodywithout any content, the file would be invalid under html 4 strict. Valid if html 4 lose. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ TR/html4/strict.dtd"> <html> <head> <META HTTP-EQUIV="Content-Type"...
3
5735
by: PYG | last post by:
Hi everybody I have a simple question : If i use this code : <body style="font-size:24px;color:blue;"> Text in body <table> <tr><td> Text in table
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.