[ASP.NET] How to add javascript between two specific tag?

T

tranky

Hi asp.net programmers,i've a question for you!

How to add javascript between two specific tag?
( for example div tag )

This javascript i must add in the page is a control, and i must
insert it beetween two div tag.

If use this.Page.ClientScript.RegisterClientScriptBlock,
the control is added in the head of the page, instead, if i use
this.Page.ClientScript.RegisterStartupScript the control is added in the
footer of the page.

In what way i can resolve this issue?

thanx
 
T

tranky

the final result should be this:

<body>

ecc...
ecc...

<div id="thisid">
<script ....>
// HERE THE JAVASCRIPT
</script>

</div>

ecc...
ecc...

</body>
 
G

Guest

IN THEPAGE:

<div id="scriptdiv">
<asp:placeHolder id="PlaceHolder1" runat="server"></asp:placeHolder>
</div>



IN THE CODEBEHIND:


string scr=@"<script>alert('yo!');</script>";
HtmlGenericControl gc = new HtmlGenericControl();
gc.InnerHtml=scr;
this.PlaceHolder1.Controls.Add(gc);


-- Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 

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,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top