Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / August 2003

Tip: Looking for answers? Try searching our database.

Problem : Works only if I have an alert

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
news.microsoft.com - 11 Aug 2003 18:28 GMT
I have posted the code below, please help me how can I make the window
object understand the new object created without using alert or
settimeout(). Also How to check a method exists in a object? it works only
if I have a property in that object then its working fine, how to check an
object's methods? I am using property"(Component1.Exists)", but I need to
find out a method or some way to know that the object is loaded.
if(Component1) always not null in this case, so I am not sure is that the
right way to check whether object is loaded or not. I would really
appreciate if somebody can help me.

thanks,

Rajan.

Code :

<BODY MS_POSITIONING="GridLayout">
 <OBJECT id="Component1"
classid="http://MachineName/Web.UI/Tem/Analysis.dll#UserControls.ucTask"
VIEWASTEXT>
 </OBJECT>
 <SCRIPT language="javascript">
  if (Component1.Exists)
  {
   run();
  }
  else
  {
   install();
     location.reload();

  }
  function run()
  {
   Component1.SetCookie(cookieName, cookieValue, cookieDomain, cookiePath);
   Component1.SetToken(tokenSecurityHandle, tokenStateHandle, tokenUserId);
   Component1.DoSomething();
  }

  function install()
  {
   var objectTagString;
//    document.write("<OBJECT id=InstallerControl
classid=http://MachineName/Web.UI/Tem/InstallerControl.dll#InstallerControl.
UserControl1 VIEWASTEXT></OBJECT>");
   objectTagString = document.createElement("<OBJECT id='InstallerControl'
classid='http://MachineName/Web.UI/Tem/InstallerControl.dll#InstallerControl
.UserControl1' VIEWASTEXT></OBJECT>");
      document.body.appendChild(objectTagString);
   // This works
    alert("Some Message");
   InstallerControl.InstallMsi();
   // or this works
   window.SetTimeout("InstallerControl.InstallMsi()", 2000);
  }

 </SCRIPT>
 <SCRIPT src="scripts/JDAFrameworkReference.js"></SCRIPT>
</BODY
bruce barker - 12 Aug 2003 03:20 GMT
IE creates, downloads if necessary, and intializes com object async, there
is no way for client code to safely call the com object without using a
setTimeout and checking the readyStatus (which is used to determine how
ready a com object is). if the user disables active/x or refuses the
download, then the object will never be ready.

a common method used by flash and others is to fire an event when the object
is ready. client code can catch the event.

normally you do sometime like this:

<script>

run();

function run ()
{
   if (window.Component1 && window.Component1.readyState == 4))
   {
        Component1.SetCookie(cookieName, cookieValue, cookieDomain,
cookiePath);
        Component1.SetToken(tokenSecurityHandle, tokenStateHandle,
tokenUserId);
        Component1.DoSomething();
    }
   else
   {
       window.setTimeout("run()",1);
   }
</script>

> I have posted the code below, please help me how can I make the window
> object understand the new object created without using alert or
[quoted text clipped - 39 lines]
>     var objectTagString;
> //    document.write("<OBJECT id=InstallerControl

classid=http://MachineName/Web.UI/Tem/InstallerControl.dll#InstallerControl.
> UserControl1 VIEWASTEXT></OBJECT>");
>     objectTagString = document.createElement("<OBJECT id='InstallerControl'

classid='http://MachineName/Web.UI/Tem/InstallerControl.dll#InstallerControl
> .UserControl1' VIEWASTEXT></OBJECT>");
>        document.body.appendChild(objectTagString);
[quoted text clipped - 8 lines]
>   <SCRIPT src="scripts/JDAFrameworkReference.js"></SCRIPT>
>  </BODY

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.