SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast nickweavers's Avatar
    Join Date
    Feb 2004
    Location
    Hampshire, UK
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Can anyone help with IE6 & IE7 javascript problems?

    I am using the YAHOO.util.Connect.asyncRequest from the Connection Manager section of the Yahoo! UI library to do some AJAX stuff on a website.
    (I write the code before I bought the excellent Sitepoint book: Ajax Web Applications ;0).

    The site is mambo CMS based and I have written a module that sits on the right hand side bar checking periodically if the user has anyone trying to chat with them.

    To do this I place the following inline scripts in the HTML body:
    Code:
    <script language="JavaScript" src="includes/js/yahoo.js"
    type="text/javascript"></script>
    <script language="JavaScript" src="includes/js/connection.js"
    type="text/javascript"></script>
    <script language="JavaScript" type="text/JavaScript">;
    <!--
    ID=window.setTimeout("getUnreadVoices();",500);
    function getUnreadVoices() {
    var sUrl =
    'http://www.chasingmidnight.com/CMS/components/com_cmff/get_unread_voices.php'
    + '?my_id=80';
    var transaction = YAHOO.util.Connect.asyncRequest('GET', sUrl,
    getUnreadVoicesCallback);
    }
    This works fine in both Firefox and Opera, but in IE6 and IE7 while it works okay when the page is first loaded, if it gets reloaded either by the browser refresh button being clicked, or the user clicking the back button after they have gone to another page, a popup alert window appears with the following message:

    An error has occurred in the script on this page.

    Line: 932
    Char: 3
    Error: 'YAHOO' is undefined
    Code: 0
    URL: http://www.chasingmidnight.com/CMS/index.php

    Do you want to continue running scripts on this page.
    When I do a view source from the browser it shows line 932 is this line:
    Code:
    var transaction = YAHOO.util.Connect.asyncRequest('GET', sUrl, getUnreadVoicesCallback);
    It's like when the page is reloaded, the
    Code:
    <script language="JavaScript" src="includes/js/yahoo.js"
    type="text/javascript"></script>
    <script language="JavaScript" src="includes/js/connection.js"
    type="text/javascript"></script>
    <script language="JavaScript" type="text/JavaScript">;
    isn't getting done.

    Does anyone have any idea why IE is doing this. I am wondering if it is related to caching on some way.

    Any help greatly appreciated,
    Nick.
    Last edited by nickweavers; Aug 2, 2006 at 00:32.


Bookmarks

Posting Permissions

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