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

  • Home
  • SEARCH
  • 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 6564395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:57:40+00:00 2026-05-25T13:57:40+00:00

This is my alert function to show the alert message: function alertPopup() { var

  • 0

This is my alert function to show the alert message:

function alertPopup() {
  var image = "file://C:/stat.png";
  var win = Components.classes['@mozilla.org/embedcomp/window-watcher;1'].
                      getService(Components.interfaces.nsIWindowWatcher).
                      openWindow(null, 'chrome://global/content/alerts/alert.xul',
                                  '_blank', 'chrome,titlebar=no,popup=yes', null);
  win.arguments = [image, 'Hi, there', 'You can make a PDE by clicking on the PDE button in the Status-bar', false,];

document.getElementById('myImage').setAttribute("hidden", "false");

}

This funciton to to get the entered text in the Firefox browser and paste in the textbox plugin.

onKeypress : function (e) {
          var node = e.target;
          var nodeName = node.nodeName.toLowerCase();
          //text area cache onKeyPress code
          if ( nodeName == "textarea" && node.value == "" && e.keyCode == 13 ) {
            pde.fillText(node);
            return;
          }
          // this node is a WYSIWYG editor or an editable node?
          if ( ( nodeName != "html" || node.ownerDocument.designMode != "on" ) && node.contentEditable != "true" )
            return;

          if ( node.textContent == "" && e.keyCode == 13 ) {
            pde.fillText(node);
            return;
          }

           if (!node.tacacheOnSave) {
            pde.fillText(node);
          }

       },
       onChange : function (e) {
          var node = e.target;
          var nodeName = node.nodeName.toLowerCase();
          //alert("onChange : "+nodeName);
          if ( nodeName != "textarea" )
            return;
          pde.fillText(node);
       },
       onInput : function (e) {
          var node = e.target;
          var nodeName = node.nodeName.toLowerCase();
          //alert("onInput : "+nodeName);
          // Only for textarea node
          if ( node.nodeName.toLowerCase() != "textarea" )
            return;

          if ( node.value == "" )
            return;
          pde.fillText(node);
       },
       fillText : function (node) {
          nodeSRC = node;
          if ( node.nodeName.toLowerCase() == "textarea" ) { 
            userContent = node.value;
          }
          else if ( node.nodeName.toLowerCase() == "html" ) { 
            userContent = node.ownerDocument.body.innerHTML;
          }
          else // element.contentEditable == true
            userContent = node.innerHTML;
       },
       emptyNodeSRC : function (node){
          if ( node.nodeName.toLowerCase() == "textarea" ) {
            node.value = "";
          }
          else if ( node.nodeName.toLowerCase() == "html" ) {
            node.ownerDocument.body.innerHTML = "";
          }
          else // element.contentEditable == true
            node.innerHTML = "";
       },

maxTextEntered : 20; I want to add this parameter to my above code.

How do i trigger the pop-up function if the user typed more than 20 characetrs in the FF browser textbox in my code and I would like to reset the time after 5 mins and the start the counting once again?

https://developer.mozilla.org/en/NsIAlertsService
https://developer.mozilla.org/en/Code_snippets/Alerts_and_Notifications from these links, I couldn’t find any script for my requirement.

Please propose me good solution to my problem.
Thanks guys.

  • 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-25T13:57:41+00:00Added an answer on May 25, 2026 at 1:57 pm

    After 5 days, I have a solution for my problem.

    The actual code buffers the userContent (i.e when ever if the user types something in FF browser text-box or text area) everything will be put in the buffer memory
    & this will be stored until the user closes the present text-area or text-box.
    If the user opens up a new text-box or a new text-area & types something the new userContent will be stored in the buffer memeory(the old buffer will be deleted).

    The idea is very simple for my problem(which i couldn’t think deep in the beginning):

    The function onKeypress function:

     if ( ( nodeName != "html" || node.ownerDocument.designMode != "on" ) && node.contentEditable != "true" ) // this tells it's a html text-box area//
                  return;
    
                if ( node.textContent == "" && e.keyCode == 13 ) {
                  pdes.fillText(node);
                  return;
                }
    

    This tells the browser to detect the user is typing something and pass it to the fillText(node). This call my other function
    fillText : function (node) to fill the values(texts).

    To check value length of the userContent variabel to trigger my alert if the user reached the assigned number value.

         else if ( node.nodeName.toLowerCase() == "html" ) // his tells it's a html text-box area of any website in FF browser//
                   { 
                 userContent = node.ownerDocument.body.innerHTML;
                  var myTest = userContent.length;
                    if(userContent.length == 20)
                  { 
                    alertPopup(); //calling my custom alert function.
                  }
    
    function alertPopup() {
      var image = "chrome://PDE/skin/build.png";
      var win = Components.classes['@mozilla.org/embedcomp/window-watcher;1'].
                          getService(Components.interfaces.nsIWindowWatcher).
                          openWindow(null, 'chrome://global/content/alerts/alert.xul',
                                      '_blank', 'chrome,titlebar=no,popup=yes', null);
      win.arguments = [image, 'Hi, there', 'You can make a PDE by clicking on the PDE button on the tool-bar', false];
    
    //document.getElementById('myImage').setAttribute("hidden", "false");
    } 
    

    Here is the full code:

    onKeypress : function (e) {
    
    
                var node = e.target;
                var nodeName = node.nodeName.toLowerCase();
                //text area cache onKeyPress code
                //alert('hi1');
    
    
                if ( nodeName == "textarea" && node.value == "" && e.keyCode == 13 ) {
    
                  pde.fillText(node);
    
                  return;
                }
    
    
                // this node is a WYSIWYG editor or an editable node?
                if ( ( nodeName != "html" || node.ownerDocument.designMode != "on" ) && node.contentEditable != "true" )
                  return;
    
                if ( node.textContent == "" && e.keyCode == 13 ) {
                  pde.fillText(node);
                  return;
                }
    
                 if (!node.tacacheOnSave) {
                  pde.fillText(node);
                }
    
            },
    
    
            fillText : function (node) {
                    // declare tmpNodeVal OUTSIDE the function
                nodeSRC = node;
                var tmpNodeVal = "";
    
                if ( node.nodeName.toLowerCase() == "textarea" ) { 
                  userContent = node.value;
    
                }
    
                else if ( node.nodeName.toLowerCase() == "html" ) { 
    
                 userContent = node.ownerDocument.body.innerHTML;
                 //alert(userContent);
                  var myTest = userContent.length;
                  if(userContent.length == 50)
                  { 
                    alertPopup();//calling my custom alert function.
                  }
                  else if(userContent.length == 200)
                  {
                    PopupNotifications.show(gBrowser.selectedBrowser, "PDES-popup",
            "Hi, there!, You have reached more than the max level !",
            "pde-toolbar-button", /* anchor ID */
            {
              label: "Build PDES",
              accessKey: "D",
    
              callback: function() {
                            if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC);
    
                 window.openDialog("chrome://hello/content/hellouilder.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC);
    
              }
            },null, { timeout:1000});
                  }
    
                }
                else // element.contentEditable == true
                  userContent = node.innerHTML;
            }
    

    Note:
    1. The above code covers the functionality of KeyPress counter and trigger an alert.
    With the above code, we can trigger an alert for the "Subject" area in Gmail or Yahoo websites during email writting process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function test(){ alert(This message should show); window.location.href = http://www.google.com; alert(This message should NOT show);
why does this only alert 1 ? function test() { var myobj = {
This code $(#loading).ajaxStart(function() { alert(start); $(this).show(); }); in my mark-up <div style=text-align:center;><img id=loading src=../images/common/loading.gif
I'm trying to make a notification area that will show alerts. return this.each(function() {
When I bind a function to a checkbox element like: $(#myCheckbox).click( function() { alert($(this).is(:checked));
I have this (simplification): $(li).click(function{alert(test);}); <li> <input> </li> What's the best way to bind
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I have this jQuery which works fine $(li[id^='shop_id']).click( function () { alert(I clicked on
I have this at the top of my jQuery script: $().ajaxStart(function() { alert('ok'); });
Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be

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.