views:

65

answers:

1

I'm looking to do a short term hack on a site. The site is a ASP.NET site with a master page. The body tag is in the master page. I'd like to specify which ID should be in the body tag from within various content pages. What I don't know is if you can have this type of access to the body tag when your JS is within the body tag. For various reasons, I'd like to try to accomplish this in JS, not .NET.

Any tips?

Rephrasing for clarity:

I would like to use JavaScript to specify a body ID from within the body tag of a site. For example:

<body id="MyID">

JS to change MyID to another name

</body>
+1  A: 

Put this in the Page_Load of any ContentPage...

string JS = "document.body.id = 'WhateverID';";
ClientScript.RegisterStartupScript(this.GetType(), "BodyID", JS, true);
Josh Stodola
Worked like a charm. Thank you!
Peachy