www.webdeveloper.com
Results 1 to 5 of 5

Thread: Problem with Javascript random-text marquee >:(

  1. #1
    Join Date
    Oct 2009
    Posts
    3

    Unhappy Problem with Javascript random-text marquee >:(

    Hi all - im having a problem with the following code:

    Code:
    var r_text = new Array ();
    r_text[0] = "Example 1";
    r_text[1] = "Example 2";
    r_text[2] = "Example 3";
    r_text[3] = "Example 4";
    r_text[4] = "Example 5";
    r_text[5] = "Example 6";
    r_text[6] = "Example 7";
    r_text[7] = "Example 8";
    r_text[8] = "Example 9";
    
    var i = Math.floor(9*Math.random());
    
       {
       document.write("<MARQUEE SCROLLAMOUNT=10><b><FONT-FAMILY:‘Calibri’>><FONT-SIZE: 14pt><FONT COLOR='#FFFF00'>" +
       r_text[i] + "</FONT></FONT-SIZE></font-family></b></MARQUEE>");
       }
    Whenever i try and input it into any website developement program - yes, it works perfectly, but for some very frustrating reason rather than font be Calibri, or Arial, or whatever i input - it always comes out as Georgia in my browser, Firefox, and Times in IE and Opera. I really really really don't understand why the font refuses to change, whereever i put it.

    Hopefully somebody here can tell me whats up?

    Thanks in advance! Joe

  2. #2
    Join Date
    Oct 2009
    Posts
    3
    by the way - naturally i include the Javascript codes at the beginning and end!

  3. #3
    Join Date
    Oct 2006
    Posts
    939
    I'm almost sure the font tag has been deprecated. Use a style tag in your marquee

  4. #4
    Join Date
    Oct 2009
    Posts
    3
    Hi - thanks for thw comment - ive tried a few things like that but everything i try just stops the whole thing from working at all.

    Can you suggest the exact code i use and where to put it per chance?

    Ahh im so coding illiterate

  5. #5
    Join Date
    Oct 2006
    Posts
    939
    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    	"http://www.w3.org/TR/html4/strict.dtd">
    <HTML>
    <HEAD><TITLE>Fr3-21pm58</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=UTF-8">
    <STYLE type=text/CSS>
    
    </STYLE>
    <SCRIPT type="text/javascript">
    function colors(){return Math.floor(225*Math.random())}
    var r_text ='Example';
    var i = Math.floor(9*Math.random());
    var M='<MARQUEE SCROLLAMOUNT=10 style="background-color:rgb('+colors()+','+colors()+','+colors()+');FONT-WEIGHT:bold;FONT-FAMILY:Calibri;FONT-SIZE: 14pt; COLOR:#FFFF00">'+r_text +'_'+i+'</MARQUEE>';
     document.write(M);
    </SCRIPT>
    <META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
    <BODY scroll="auto">
    
    </BODY></HTML>

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