SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist Mr. Tech's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mootools... $('description').innerHTML giving an error in IE7 & IE6

    I'm using Mootools and some of my own code to made an audio file play... here's the entire function:

    Code JavaScript:
    function playAudio(audio,title,artist,description,albumart,isfirst) {
        var isfirst;
        var albumart;
        var title;
        var artist;
        var description;
     
        $('albumart').src = albumart;
        $('title').innerHTML = title;
        $('artist').innerHTML = artist;
        $('description').innerHTML = description;
        if (isfirst != true) {
            sendEvent('stop');
            loadFile({file:audio});
            sendEvent('playpause');
        }
    }

    Everything works like a charm except the following in IE7 & IE6:

    Code JavaScript:
    $('description').innerHTML = description;

    About 1 in 5 refreshes, it works but the rest of the times gives this error:

    Line: 12
    Char: 2
    Error 'null' is null or not an object
    Code: 0
    The above code is on line 12 and when the error appears the description does not show in the #description div...

    Any ideas what might be wrong?

  2. #2
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How exactly do you call the function when you get the error?

  3. #3
    SitePoint Evangelist Mr. Tech's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    562
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <a href="javascript:;" onclick="playAudio('media/audio/song1.mp3','Song Title','Artist','Description goes here.','media/audio/thumb.png','');">

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,676
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    If the description contains a quote such as John's Favourite Picks, what then happens?


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
  •