In this case, placing the JavaScript anywhere on the page can have differents
results.
That javascript I want to embed in the page is only a function call that
draws a DHTML menu (programmed by a third party). The menu is drawn where
that function is called, using relative positioning
In the current scenario I have:
<form id="frmMain" runat="server">
<div>
<div style="z-index: 101; left: 0px; width: 100%; position: static;
overflow: visible; border-top-width: 5px; border-left-width: 5px;
border-left-color: green; border-bottom-width: 5px; border-bottom-color:
green; border-top-color: green; border-right-width: 5px; border-right-color:
green;">
SOME CONTENT
</div>
</div>
</form>
If I use RegisterStartupScript, the script is placed just before the closing
</form> tag. That causes the menu to appear after "SOME CONTENT". I need it
to be placed before it, so it would be sufficient if if is placed just after
the first <div> tag.
I hope it's clear now why I need to place a JavaScript code in a specific
location.
Jaime
"Jason L Lind" wrote:
Javascript can be run from any point on the page no matter where it is, so I
don't see why placement of it would be of any importance.
What I would do is place a Literal ASP Web Control right below where you
want to place it and then in the codebehind do this:
this.litJavaScript.Text = "<script
type=\"text/javascript\">Javascript</script>";
Hope that helps,
Jason Lind
"Jaime Stuardo" wrote:
Hi all...
I need to add some JavaScript code that is dynamically generated to some
point of the page.
Currently I'm using
ClientScript.RegisterStartupScript(GetType(), "menu", "<script
type=\"text/javascript\">" + oMenu.BuildMenu(true, true, true) + "</script>");
But the script is added to the end of the page, but I need it to be added at
the begining of the page (after <BODY> tag).
How can I do it?
Thanks
Jaime