www.webdeveloper.com
Results 1 to 4 of 4

Thread: continuously testing

  1. #1
    Join Date
    Jun 2011
    Posts
    5

    continuously testing

    Not to sure what to do say but here it goes. I am trying to test when a certain part of my page is in focus to display a message box. Here is the page http://yftg.ca/Untitled-5.html.
    I would like this code to running at all times when on this page.
    Code:
    if(Element.tabIndex = 27)
    {
    	if(document.getElementById("entry_53").value > 30)
    	{
    		var ade = document.getElementById("entry_53").value - 30;
    		alert( "Please Deposit " + ade);
    	}
    }
    What this code is suppost to do is when the table Amount in Deposit Envelope is in focus or the cursor is in the first box of that table a message box pops up telling the user what the total of that table is supposed to be. If there is a better way to do this I would be grateful for your help thank you.

  2. #2
    Join Date
    Jul 2009
    Posts
    184
    It looks like you're just missing how to trigger the message. You could use the onFocus method to trigger a function that displays the msg, when that particular input is focused on.

    Code:
    var input = document.getElementById('idOfInputHere');
    input.onFocus = displayMsgOnFocus(input.id);
    
    function displayMsgOnFocus(elementId)
    {
         if(elementId == inputIdYouWantToTarget)
          {
    	alert( "Please Make a Deposit");
          }
    }
    FYI: that is just an idea to get you going, not a complete solution.

  3. #3
    Join Date
    Jun 2011
    Posts
    5
    I have tried it with onFocus but user is unable to do anything because the message box keeps popping up when the first box is in focus. Is there another way to work around this?

  4. #4
    Join Date
    Jul 2009
    Posts
    184
    Not sure what the issue is then, from your description.

    You said:
    ...when a certain part of my page is in focus to display a message box.
    Now that the message shows when the first input gets focused on, it's become an issue?

    Seems contradictory to me, so I must be missing something. Is the issue that the message box shows up EVERYTIME a user focuses on that input?

    If that's the case, you'll need to clarify under what conditions the message box should show.

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