Random image

  • Unknown's avatar

    I write this code in wordpress editor and it works:

    <script type=”text/javascript”>
    // <![CDATA[
    Array.prototype.random = function(limit){
    if (typeof limit == ‘undefined’ || limit < 0) limit = 1;
    else if (!limit) limit = this.length;

    for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++){
    do { var index = Math.random(); } while (index == 1);
    index = Math.floor(index * n);
    target.push(source[index]);
    source[index] = source[–n];
    }
    return target;
    }

    document.write(new Array(
    //tablica zawierająca bazę tekstów
    ‘Tekst 1’,
    ‘Tekst 2’,
    ‘Tekst 3’
    ).random().join(”));
    // ]]>
    </script>

    but on my website https://medelskiandkowalewski.wordpress.com/memy/
    it doesn’t want work. Why?

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    You can’t put scripts and other html code in a free wordpress.com website. To do so you must upgrade to the Business Plan, https://wordpress.com/pricing/

  • The topic ‘Random image’ is closed to new replies.