Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Posts
    23
    Rep Power
    0

    Question Browser minimizes but then comes back again automatically! Java Script problem!

    Hi all,

    I am trying to do date validation in my html page using javascript.My code is as follows:

    HTML code:

    XML Code:
    <td><input name="expires" id="expires" type="text" onblur="Date_Validator2();" ></td>
    Java Script Code:

    Java Code:
    function Date_Validator2(){
    	
    	var chkdate = document.getElementById("expires").value;
    	if(chkdate == "")
    	{
    		alert("Please enter the Date..!!");
    		PostAvailableBench.expires.focus();
    		break;
    	}else if(chkdate.match(/^\d{4}\-\d{2}\-\d{2}$/))
    	{
    	  alert('works out');
    	  
    	}
    	else
    	{
    		alert("date format should be YYYY-MM-DD");
    		PostAvailableBench.expires.focus();
    		break;
    	}
    	
    }

    the problem here is :

    After trying to test my code by entering the date value, I try to minimize the browser to carry on with the rest of the coding.. But the browser immediately comes back up with out even clicking on it and starts to give alert messages.. Im not really able to figure out what could be the problem..?Is it that my if statement goes into a loop due to something or anything else that I am not aware of ?

    I would be glad if someone could help.. Thank You

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: Browser minimizes but then comes back again automatically! Java Script problem!

    Java != Javascript.
    You need to find a Javascript forum.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default Re: Browser minimizes but then comes back again automatically! Java Script problem!

    @javabeginner29 why you are using this line of code: PostAvailableBench.expires.focus(); ?
    What's purpose of that line of code?

    Can you give me a full code that I can copy+paste it to .html file to see If I could help you.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Browser minimizes but then comes back again automatically! Java Script problem!

    Quote Originally Posted by cselic View Post
    @javabeginner29 why you are using this line of code: PostAvailableBench.expires.focus(); ?
    What's purpose of that line of code?

    Can you give me a full code that I can copy+paste it to .html file to see If I could help you.
    This is a Java forum. If you want to offer JavaScript help, find a JavaScript forum.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Scriptlet Not Running on JSP after coming back from back button of browser
    By jason.3dmagic in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 06-23-2011, 07:44 AM
  2. Browser's back button refresh the pages
    By hasansheikh18 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 05-31-2011, 04:44 PM
  3. Replies: 1
    Last Post: 04-15-2011, 04:36 PM
  4. problem with back button of the browser.
    By shivakumari in forum Java Servlet
    Replies: 2
    Last Post: 03-25-2009, 07:41 AM
  5. Replies: 0
    Last Post: 03-23-2009, 04:19 PM

Posting Permissions

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