I've got a little update. I've just found out that my code works in IE but not Firefox which I used initialy. So I still have to figure out how to make it cross-browser compatibile.
HTML code:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript">
function helloworld() {
var style = document.getElementById("mySilverlightControl").style;
style.left = '200px';
style.top = '200px';
alert('test');
}
</script>
</head>
<body>
<div id="myTestControl" style="backgroung-color: white; position: absolute; ">
test
</div>
<!-- Where the Silverlight control will go-->
<div id="mySilverlightControl" style="backgroung-color: white; position: absolute; left: 0px">
</div>
<script type="text/javascript">
// Retrieve the div element you created in the previous step.
var parentElement =
document.getElementById("mySilverlightControl");
Sys.Silverlight.createObject(
"test.xaml", // Source property value.
parentElement, // DOM reference to hosting DIV tag.
"mySilverlightControl", // Unique control ID value.
{ // Control properties.
width:'300', // Width of rectangular region of
// control in pixels.
height:'300', // Height of rectangular region of
// control in pixels.
inplaceInstallPrompt:false, // Determines whether to display
// in-place install prompt if
// invalid version detected.
background:'#00000000', // Background color of control.
isWindowless:'true', // Determines whether to display control
// in Windowless mode.
framerate:'24', // MaxFrameRate property value.
version:'0.9' // Control version to use.
},
{
onError:null, // OnError property value --
// event handler function name.
onLoad:null // OnLoad property value --
// event handler function name.
},
null); // Context value -- event handler function name.
</script>
</body>
</html>