www.webdeveloper.com
Results 1 to 9 of 9

Thread: The <OBJECT> tag

  1. #1
    Join Date
    Nov 2002
    Posts
    8

    The <OBJECT> tag

    Hi all,
    I hope someone will be able to help we this problem:

    Basically, what I want to do is to call a javascript function in the <OBJECT> tag, when the ActiveX content of this tag failed to load.

    That means:

    <OBJECT CLASSID="some-class-id" ODEBASE="some-codebase">
    <PARAM name="some-param" value="some-value">

    <!-- If user stop while the ActiveX loading, this part is called -->

    AND HERE I WANT TO CALL JAVASCRIPT FUNCTION, IE:

    <script>load_failed();</script>

    </OBJECT>

    But it looks like, tha javascript is not working inside of the object tag. I want this javascript function to be called automatically, without any user input.

    Does anybody know how to do it ?
    Thanks for any help.

    Marek

  2. #2
    Join Date
    Nov 2002
    Posts
    984

    Re: The <OBJECT> tag

    Originally posted by marekk
    <!-- If user stop while the ActiveX loading, this part is called -->

    AND HERE I WANT TO CALL JAVASCRIPT FUNCTION, IE:
    This is your problem.
    You can't suddenly switch to the alternate content of an <object> tag.

    The alternate content is only supposed to come in effect if the main content (in this case your ActiveX) is not understood by the browser.

    In your case you are already in a state where the main content is accepted by the browser and the external resource have begun to download.

    In short, you have to figure out another method to get the "download canseled" trigger.
    // Stefan Huszics

  3. #3
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by Dave Clark
    Answered and working in the JavaScript forum.

    http://forums.webdeveloper.com/showt...=&threadid=593

    Dave
    Well, partially at least.

    None of
    onError=
    onStop=
    onAbort=

    is actually valid HTML
    http://www.w3.org/TR/html4/interact/....html#h-18.2.3

    But since we are dealing with ActiveX, I guess the original poster isn't too concerned with cross browser compability anyway.
    // Stefan Huszics

  4. #4
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by Dave Clark
    [B]You still have this problem with confusing what is "valid" with what is considered according to "standards":
    No the problem is that you don't understand that if it's not in the SPEC it's not HTML, becuse the "standards" defines what is HTML.

    The problem isn't that you offer people help and provide them with invalid code that works in some browsers, the problem is that you don TELL people that your solution consists of proprietary code.
    // Stefan Huszics

  5. #5
    Join Date
    Nov 2002
    Posts
    984
    [i]Originally posted by Dave What would it matter if I told him that that code might not work in any browser except IE?
    Becuse next time he (or someone else reading this forum) wants to use your code example it might not be in combination with ActiveX...

    You never know where your code will end up, thus pointing out the flaws in it might save the person trying to use it a lot of headache.
    Last edited by Stefan; 12-06-2002 at 07:41 AM.
    // Stefan Huszics

  6. #6
    Join Date
    Nov 2002
    Posts
    4,473
    From the HTML 4.01 W3C RECOMMENDATION:
    Note. Authors of HTML documents are advised that changes are likely to occur in the realm of intrinsic events (e.g., how scripts are bound to events). Research in this realm is carried on by members of the W3C Document Object Model Working Group (see the W3C Web Site at http://www.w3.org/ for more information).
    Just because their committee cannot decide to recommend an event handler (even one that has been in use for years, like "onError") does not constitute using it a sin.

    Netscape has supported the following events since JavaScript 1.0 (asterisks indicate included in W3C recommendation):

    onAbort
    onBlur *
    onChange *
    onClick *
    onDblClick *
    onDragDrop
    onError
    onFocus *
    onKeyDown *
    onKeyPress *
    onKeyUp *
    onLoad *
    onMouseDown *
    onMouseMove *
    onMouseOut *
    onMouseOver *
    onMouseUp *
    onMove
    onReset *
    onResize
    onSelect *
    onSubmit *
    onUnload *

    IE supports these and a ton more.

    A lot of the ones that W3C does not include in their recommendation have to do with window objects. In fact, they do not enter the window object realm at all. They are only interested in the document (and perhaps rightly so).

  7. #7
    Join Date
    Nov 2002
    Posts
    984
    Originally posted by gil davis

    Just because their committee cannot decide to recommend an event handler (even one that has been in use for years, like "onError") does not constitute using it a sin.
    There is nothing preventing you from using event handlers that is not in the HTML spec... but DONT't put them in the HTML... keep them in the javascript where they belong.

    The point here is that there is a right way to do it (that will give you valid code) and a wrong way (generally prefered by clark).

    Even the very MS documentation page he links to shows how to add eg onerror the right way, he just likes to break the specs for the hell of it.

    http://msdn.microsoft.com/workshop/a...ts/onerror.asp

    eg

    <script>
    ...
    hepp.onerror=
    ...
    </script>

    <object id="hepp"...

    Last edited by Stefan; 12-06-2002 at 08:56 AM.
    // Stefan Huszics

  8. #8
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    If it works (and it does -- as testified to by the person I helped), then it is valid

    Many authors rely on a limited set of browsers to check on the documents they produce, assuming that if the browsers can render their documents they are valid. Unfortunately, this is a very ineffective means of verifying a document's validity precisely because browsers are designed to cope with invalid documents by rendering them as well as they can to avoid frustrating users.
    In other words, you're saying your code is valid because it works in a program whose first assumption is that you don't know what you're doing.

  9. #9
    Join Date
    Mar 2011
    Posts
    1
    Quote Originally Posted by marekk View Post
    Hi all,
    I hope someone will be able to help we this problem:
    Basically, what I want to do is to call a javascript function in the <OBJECT> tag, when the ActiveX content of this tag failed to load.
    That means:
    <OBJECT CLASSID="some-class-id" ODEBASE="some-codebase">
    <PARAM name="some-param" value="some-value">
    <!-- If user stop while the ActiveX loading, this part is called -->
    AND HERE I WANT TO CALL JAVASCRIPT FUNCTION, IE:
    <script>load_failed();</script>
    </OBJECT>
    But it looks like, tha javascript is not working inside of the object tag. I want this javascript function to be called automatically, without any user input.
    Does anybody know how to do it ?
    Thanks for any help.
    Marek
    My workin java script

    <script type="text/javascript">
    function menuOn(e, color) {
    if ( ! color ) {
    color = 'green';
    }
    e.style.backgroundColor=color;
    e.style.opacity='.50';
    e.style.filter='alpha(opacity=50)';
    e.style.border = '1px solid black';
    }

    function menuOff(e) {
    e.style.opacity = 0;
    e.style.filter = 'alpha(opacity=0)';
    }</script>


    <div class="first" onclick="location.href='http://mysite/'" onmouseover="menuOn(this,'green');" onmouseout="menuOff(this);"></div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles