Q: How add the (Runtime) script tag of type=text/xaml using JavaScript inside body tag which will be accessed by the Silverlight Object automatically?
The Script written in blue color need to generate in runtime and need to be inserted inside the body tag…
So after adding the script dynamically the out put page should be
<Html>
<Head> </head>
<Body>
<script type=text/xaml id=my script>
<ABC data=”abcd”>
</ABC>
</Script>
<script type=text/JavaScript >
function create_myscript_in_body_tag ( )
{
/* what should be my Code here?*/
}
create_myscript_in_body_tag( ); //---calling the function to create script tag inside body in runtime…
<Script>
</body>
<Html>
Even i have tried with the following codes....I failled....
var
myscript='<script id="xxx" type="text/xaml" >';
myscript +=
'<Can ' Width="640" Height="400">';
myscript +=
' <Can x:Name="plotarea" Can.Top="0" Can.Left="0" >';
myscript +=
' </Can>';
myscript +=
' </Can>';
myscript +=
' </script>';
function mine()
{
var hd1 = document.getElementsByTagName('body')[0];
var scr = document.createElement('script');
scr.type =
'text/xaml';
scr.text = myscript;
hd1.appendChild(scr);
}
Then What is the Problem?
Silverlight Object is unable to find out the Script tag from the body part, using the id 'xxx'.................
Silverlight Object should access that xaml created at runtime inside body tag...
Please Help............