Here's where many web developers really feel at home. They love JavaScript! The reader may wonder what JavaScript lovers are doing with Silverlight. There are a few reasons for this. Both JavaScript and Silverlight complement each other. On the other hand, the architecture we can build with JavaScript, even if we are extremely organized, cannot match the tidiness we can achieve with Silverlight.
The access to a Silverlight object from JavaScript code is quite easy. It is only necessary to have the Silverlight object instantiated and specify which methods will be accessed from JavaScript in Silverlight.
To register a Silverlight object, we will use the event onLoad
of the element of the type Object
, which contains the Silverlight application in the HTML page, to obtain an instance of the Silverlight application as soon as it is loaded.
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%...