Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code to change what it says in the header?

    (NB: Currently, on the upper strip of my browser window, it says "CodingForums.com-Post New Thread"; my husband says that that area is called the "header," but if that's wrong, be aware that that's the area I mean.)

    I saw a site yesterday that had changing words on the header, occurring at brief intervals; through a browser crash and my failure to copy out either the code, or the URL contained within the code saying where it came from, in time, I have no way to duplicate it... and, as I know NOTHING about JavaScript, I can't even TRY to duplicate it myself.

    If anyone has any idea how to do this, or where I can go to copy this sort of code, I'd really apprciate it!! :-)

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That area of the browser window is the 'title bar', and the text displayed there is defined in a <title> element, which can be accessed from a script as an element object, or the document.title property, but anyway, searching for [JavaScript "scrolling title"] will probably turn up a few scripts...
    Last edited by codegoboom; 03-14-2005 at 05:37 AM. Reason: oops, I misspelled scrolling... ;)
    *this message will self destruct in n-seconds*

  • #3
    New Coder
    Join Date
    Mar 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did that search, and I DID find a bunch of sites with code for scrolling; it's cool, so thanks for that!! :-)

    However, what I saw wasn't scrolling; the entire text in the title bar was changing all together. In the code, which I got an all too short a glimpse of, there was a list of lines of text that was being cycled through, and I'm pretty sure some sort of way to choose how long between changes also. Have you got any idea how to do that, or what search I can do to find code for this?

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's no special word for that action, as far as I know--apart from the obvious... switch, change, cycle, interval, array, etc.
    *this message will self destruct in n-seconds*

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Try searching for "javascript scrolling status bar" scripts. Then modify the script by changing all occurrences of window.status to document.title.

    Here's one I found in google using that keyword.

  • #6
    New Coder
    Join Date
    Mar 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by codegoboom
    There's no special word for that action, as far as I know--apart from the obvious... switch, change, cycle, interval, array, etc.
    None of that is obvious to ME, lol; I don't know a single JavaScript command. I'm not looking for special words, I need a chunk of code I can copy that makes what's on the title bar change.


    Quote Originally Posted by glenngv
    Try searching for "javascript scrolling status bar" scripts. Then modify the script by changing all occurrences of window.status to document.title.

    Here's one I found in google using that keyword.

    That would give me a scrolling message on the title bar, which I've already found code for; what I'm loking for is code to produce NON-scrolling text change in the title bar.

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    this(<--link) may be what you are looking for, with a slight modification here

    Code:
    function A() {
    s++;
    if (s > 8) { s = 1;}
    // you can fiddle with the patterns here...
    if (s == 1) { document.title = '||||||====||| '+T+' -----'; }
    if (s == 2) { document.title = '|||=|||===||| '+T+' -----'; }
    if (s == 3) { document.title = '|||==|||==||| '+T+' -----'; }
    if (s == 4) { document.title = '|||===|||=||| '+T+' -----'; }
    if (s == 5) { document.title = '|||====|||||| '+T+' -----'; }
    if (s == 6) { document.title = '|||===|||=||| '+T+' -----'; }
    if (s == 7) { document.title = '|||==|||==||| '+T+' -----'; }
    if (s == 8) { document.title = '|||=|||===||| '+T+' -----'; }
    if (C < (8 * reps)) {
    sT = setTimeout("A()", speed);
    C++;
    }

    you can change the stuff that looks like this |||==|||==||| '+T+' ----- to titles of your choice, this one cycles through 8 titles

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Quote Originally Posted by Omni
    what I'm loking for is code to produce NON-scrolling text change in the title bar.
    Like this?
    Code:
    <html>
    <head>
    <title>CodingForums.com</title>
    <script type="text/javascript">
    var idx = 1; //set it to 1 if the default title is the same with first item in the array, else set it to 0;
    var arr = new Array();
    arr[0] = "CodingForums.com";
    arr[1] = "The best programming forum on the Web";
    arr[2] = "and the home of the most helpful members. :)";
    arr[3] = "Go visit www.codingforums.com to find out for yourself.";
    //...add as many items as needed
    
    var len = arr.length - 1;
    
    function scrollTitle(){
      document.title = arr[idx];     
      idx = (idx == len) ? 0 : idx + 1;
    }
    
    window.onload = function(){
     setInterval(scrollTitle, 3000);  //3 sec delay, change as needed
    }
    </script>
    </head>
    <body>
    Look at the title bar!
    </body>
    </html>

  • #9
    New Coder
    Join Date
    Mar 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    THAT'S IT!! Thanks much!! :-)


  •  

    Posting Permissions

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