Saturday, December 29, 2007

JavaScript: Auto-activate all ActiveX controls on the page

// ***
// Activates all ActiveX controls on the page without needing to click on it
// ***
function activate_activex()
{
objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
objects[i].outerHTML = objects[i].outerHTML;
}
}

3 comments:

  1. Hi thanks for the code, But Shall we need to call this function in Page_Onload() event? If so please give the activate_activex() function calling statements.

    ReplyDelete
  2. Absolutely. The reason I only have this function listed above is so that you can call it from any place you want, including Page_Onload().

    ReplyDelete
  3. If you do this, you will loose all FlashVars in that page and also add LOTS of unwanted garbage parameters in the page...

    This is because outerHTML/ innerHTML DOES NOT return proper value.

    ReplyDelete

Please use your common sense before making a comment, and I truly appreciate your constructive criticisms.