SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2005
    Location
    Perth
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Restricted Active Content

    I got a random image code off a website where every refresh changes the image.

    Code:
    <SCRIPT LANGUAGE="Javascript"><!--
    
    // ***********************************************
    // AUTHOR: WWW.CGISCRIPT.NET, LLC
    // URL: http://www.cgiscript.net
    // Use the script, just leave this message intact.
    // Download your FREE CGI/Perl Scripts today!
    // ( http://www.cgiscript.net/scripts.htm )
    // ***********************************************
    
    function image() {
    };
    
    image = new image();
    number = 0;
    
    // imageArray
    image[number++] = "<img src='candle.gif' border='0'>"
    image[number++] = "<img src='candle1.gif' border='0'>"
    image[number++] = "<img src='candle2.gif' border='0'>"
    image[number++] = "<img src='candle5.gif' border='0'>"
    image[number++] = "<img src='candle4.gif' border='0'>"
    // keep adding items here...
    
    increment = Math.floor(Math.random() * number);
    
    document.write(image[increment]);
    
    //--></SCRIPT>
    When I am testing the site on my browser my Windows Service Pack 2 thing reacts and "restricts the active content" making the site appear imageless. I doubt I can rely on visitors allowing the active content.

    Is there a way to stop it? Is there a script that does the same thing but doesn't cause this reaction?

  2. #2
    SitePoint Addict NikoB's Avatar
    Join Date
    Nov 2005
    Location
    Austria
    Posts
    211
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it depends on what ie sp2 defines as "active content".. it definitely does so for document.write
    If it doesnt see DOM operations (like appendChild or setattribute) as "active" you can easily replace document.write with a dom function (like document.getElementById("candle").src=image[increment]; )
    you would have to change the image array so it only holds the gif too

    but i am not sure about how ie reacts...
    Corinis OpenSource Community & Content Management
    http://www.corinis.org


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
  •