Which code segment should you use?

You are developing a Silverlight 4 application. The Web page of the application contains a Text Box that has the txtTime ID. You define the following JavaScript function on the Web page.
function ShowTime(strTime) {
document.getElementById(‘txtTime’).value = strTime;
}
You need to pass the current time to the ShowTime function from Silverlight. Which code segment should you use?

You are developing a Silverlight 4 application. The Web page of the application contains a Text Box that has the txtTime ID. You define the following JavaScript function on the Web page.
function ShowTime(strTime) {
document.getElementById(‘txtTime’).value = strTime;
}
You need to pass the current time to the ShowTime function from Silverlight. Which code segment should you use?

A.
HtmlPage.Window.Invoke(“ShowTime”, DateTime.Now.ToString());

B.
HtmlPage.Window.InvokeSelf(“ShowTime(” + DateTime.Now.ToString() + “)”);

C.
HtmlPage.Window.Invoke(“ShowTime(” + DateTime.Now.ToString() + “)”, null);

D.
HtmlPage.Window.InvokeSelf(“javascript: ShowTime(” + DateTime.Now.ToString() + “)”);



Leave a Reply 0

Your email address will not be published. Required fields are marked *