Wednesday, May 11, 2011

E-mail Validation in javascript










Email:






Monday, May 9, 2011

Check and Get the focus on the input box through JavaScript on the UIWebView in iPhone.




  Document.body.focus();
  var  inID = document.activeElement.id;
   function Function1Delay()
      {
         if(document.activeElement .id  !=  inID)
          {
             inID = document.activeElement.id;
             alert('Start Scan');
             document.getElementById(inID).value='Dinesh Sharma';
             setTimeout("Func1Dealy()",200); 
          }
         else
          {
            setTimeout("Func1Delay()",500); 
          }
      }


1.

NSString *str12 = [NSString stringWithFormat:@"document.body.focus(); var inii=document.activeElement.id; function Func1Delay() {if(document.activeElement.id != inii){inii=document.activeElement.id; alert('start scan');document.getElementById(inii).value='dinesh sharma';setTimeout(\"Func1Delay()\", 500);} else { setTimeout(\"Func1Delay()\", 500);}}"];
[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@" %@ Func1Delay(); ",str12]];


2.

/*
NSString *str1 = [NSString stringWithFormat:@"function showAlert() { alert('%@');}",str];
[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"%@ showAlert(); ",str1]];
    */
3.[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var field = document.forms[0].q;" "field.value='something';"]];
//[myWeb stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var field = document.activeElement; field.value='Dinesh Sharma';"]];