Question updated. Update at the bottom-
I have to put script on a page. Unfortunately, I don't have control over the header or footer or even the body tag. All, I have is a set of inner html that goes inside a wrapping DIV which sits inside the body tag. Something like this:
<body>
<div id="wrap">
<!-- My controlled content -->
</div>
</body>
Now, I have to place some javascript. So, I obviously put it inside the section that I control. The problem is that the javascript is not being executed. I even put an alert but there is NO alert box popping up. The final code looks something like this:
<body>
<div id="wrap">
<div id="mycontent">
<script type="text/javascript" language="javascript" src="somesource"></script>
<script>
var x, y;
//Do something here with x,y;
alert("hello");
</script>
</div>
</div>
</body>
Any idea what could be wrong? And how I can fix it?
Thanks.
UPDATE: I am not sure if this makes any difference, but I forgot to mention that all this HTML is present inside a frame tag (under a frameset). Will that make a difference?
<script>appear in the source code of the resulting page? Do you get any error messages? Is your<script>valid for the page's doctype (i.e. do you need to set a type attribute)?