Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:37:22+00:00 2026-05-30T07:37:22+00:00

I am working on a way to flash a browser tab when a new

  • 0

I am working on a way to flash a browser tab when a new message appears in a table. I have the flashing of the tab part working, my only problem is that I can’t seem to get it to flash when a message is received (which is the whole point of my exercise 🙂 )

The newMessage() function is working fine, I just can’t seem to get the notification() function to work.

My code is as follows:

function newMessage() 
     {
      var oldTitle = "Your Page";
      var msg = "New Message";

      var timeout = setInterval(function() 
      { 
        document.title = document.title == msg ? '' : msg;
      }, 1000);

      window.onmousemove = function() {
          clearInterval(timeout);
          document.title = oldTitle;
          window.onmousemove = null;
      };
     }

function notification()
     {
       var index = 2;

       var content = document.getElementById('refreshMessages').childNodes[index];

        var content = document.getElementById('refreshMessages').getElementByTagName("tr")[1];

        var knownContent = content.toString();

        updater.start();

        updater2.start();

        var newContent = document.getElementById('refreshMessages').childNodes[index];

        var newContent = document.getElementById('refreshMessages').getElementByTagName("tr")[1];

        if(knownContent != newContent.toString())
        {
           newMessage();
           knownContent = newContent;
        }
        else if(knownContent = newContent.toString())
          {
            alert("No need to flash title.");
          }
     }
     notification();

In the notification() function, I am trying to call the newMessage() function by comparing the strings at the appropiate cell in the table.

I put the alert() into the else if just to see if it would be called, but it does not happen. update.start() and update2.start() are carried out however, as I can see the messages appearing in the table.

I would be happier to use JavaScript but I am open to jQuery also.

My JavaScript is very very rusty so excuse me if I have made any silly mistakes!

Thanks,

Chuck

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:37:23+00:00Added an answer on May 30, 2026 at 7:37 am

    You have several mistakes in function notification(), see my comments:

    function notification()
    {
        var index = 2;
    
        //Why are you assigning value to "content" for twice?
        var content = document.getElementById('refreshMessages').childNodes[index];
        /*
        * function getElementByTagName is undefined, should be getElementsByTagName, 
        *  's' is missing. And [1] means the second one not the first one, make sure
        *  that's exactly what you want.
        */
        var content = document.getElementById('refreshMessages').getElementByTagName("tr")[1];
    
        /*
        * content is a tr dom object, content.toString() is something like "[object]".
        * If you want to get content inside a cell, you should use cell.innerHTML.
        * e.g. A table: 
        * <table id="refreshMessages">
        *     <tr><td>Hello world</td></tr>
        * </table>
        * var table = document.getElementById('refreshMessages');
        * var firstTr = table.getElementsByTagName("tr")[0];
        * var firstTd = firstTr.getElementsByTagName("td")[0];
        * alert(firstTd.innerHTML);      //alerts "Hello world"
        */
        var knownContent = content.toString();
    
        //I doubt these functions really get invoked cuz there's javascript error above.
        updater.start();
    
        updater2.start();
    
        //assigning twice, "getElementByTagName" is missing "s"
        var newContent = document.getElementById('refreshMessages').childNodes[index];
        var newContent = document.getElementById('refreshMessages').getElementByTagName("tr")[1];
    
        //Remove toString(), use innerHTML i metioned above.
        if(knownContent != newContent.toString())
        {
           newMessage();
           knownContent = newContent;
        }
        //You miss an "=" here, to judge a equals b, you should use "=="
        else if(knownContent = newContent.toString())
        {
            alert("No need to flash title.");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying find a way to have PHP to indicate to the browser that
I have developed a simple interactive Flash game, but now it appears that sometimes
Heyas. I have an flash app that I'm working on that can be embedded
I have been working my way through Scott Guthrie's excellent post on ASP.NET MVC
I'm working my way through some ASP.NET MVC reading and I have a web
I have inherited some code that is not working as I think it should:
I've been fiddling with WebGL lately, and have gotten a Collada reader working. Problem
HI, I have a flash application (working demo here ) which I'm using to
I am working on a Flash app that is 900x700 pixels. When viewed in
I am working on a C# chat client that needs to have a sending

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.