prakashtss
01-19-2008, 04:03 AM
I am trying to change the Script Block in a Div and Execute the Block.
I am able to write the Script Block, But not sure, How to invoke the Script.
It is cruicial, I execute the Script after writing to it.
Any Ideas ?? .
Here is the sample Code, I am trying to Execute
<div id="TryDIv">
<script>
document.write('Written when doc is loaded');
</script>
</div>
<input type=button value='DoIt' onclick='DoIt()'>
<script>
function DoIt()
{
var myDiv= document.getElementById('TryDIv');
myDiv.innerHTML='<scr'+'ipt>document.write("written after Button Click")</scr'+'ipt>';}</script>
I am able to write the Script Block, But not sure, How to invoke the Script.
It is cruicial, I execute the Script after writing to it.
Any Ideas ?? .
Here is the sample Code, I am trying to Execute
<div id="TryDIv">
<script>
document.write('Written when doc is loaded');
</script>
</div>
<input type=button value='DoIt' onclick='DoIt()'>
<script>
function DoIt()
{
var myDiv= document.getElementById('TryDIv');
myDiv.innerHTML='<scr'+'ipt>document.write("written after Button Click")</scr'+'ipt>';}</script>