Posts

multiple checkboxes with same id

Handling multiple checkboxes with same id's If suppose you have defined more than one checkboxes with sdame id's, then it will treat it as an array of names. <form name="CheckBoxForm"> <input type="Checkbox" name="myCheckbox" id="myCheckbox"  /> <input type="Checkbox" name="myCheckbox" id="myCheckbox"  /> <input type="Checkbox" name="myCheckbox" id="myCheckbox"  /> <input type="Checkbox" name="myCheckbox" id="myCheckbox"  /> <input type="" onclick="testCheckboxes()" /> </form> Now according to HTML, id must be unique. So here it will treat them like an array. So if you want to access them, do as given here, function testCheckboxes(){ var myCheckboxArray= new Array(); var total=document.getElementsByName('myCheckbox').length; for(var i=0;i<total;i++){ ...

Email address validation at client and server side

Email validation at client side(Java Script) --------------------------------------------- function validateEmailAddress(emailAddress) {      var expression = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;     return expression.test(email); } This function will return true if it is a valid email address otherwise false if it is invalid email address. ---------------------------------------------- Email validation at server side using Java ----------------------------------------------- import java.util.regex.Matcher; import java.util.regex.Pattern; public class EmailAddressValidator{  private Pattern pattern;  private Matcher matcher;  private static final String EMAIL_ADDRESS_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";  public Email...

Scrolable div in CSS/html

Scrolable DIV: overflow: auto   => It will create a scrollbar - horizontal, vertical or both only if the content in the block                     requires it. overflow: scroll => It will will insert horizontal and vertical scrollbars. They will become active and shown                     only if the content requires it. overflow: visible => It will cause the content of the block to expand outside of it and be visible at the same time. overflow: hidden =>  This forces the block to only show content that fits in the block. Remainng content will                                   be  clipped and not visible to you. There will be no scrollbars. For ex: <div class="scrolableDiv"....></div> where in CSS class: .scrolableDiv{   height:180...

Accessing parent window form from child window in html

Accessing parent window form from child window in html window.parent.document.parentFormName.submit(); Here parentFormName is the name of Form of parent window that you want to submit from child window. Ex, <form name="parentFormName".....> Accessing parent window's form input parameters to child window, var userName= window.parent.document.getElementById('userName').value; Here userName is the id element of input field on parent form. Ex.     <form name="parentFormName".....> <input type="text" id="userName" /> </form> ---------------------------------------------------------------------------------------------------------------

Get contact list from Gmail account using java

You can get all contacts exists in your gmail account using this program... First you will need the jar file  gdata  (library files for fetching data from google)... --------------------------------------------------------------------------------- public static  List<ContactDTO> getAllGmailContacts(String gmailId,String password) throws ServiceException, IOException {      InstrumentDTO contactDTO; String name; List<ContactDTO> myGmailContactList= new ArrayList<ContactDTO>(); ContactsService myService = new ContactsService("Find_Contacts_On_Gmail"); myService.setUserCredentials(gmailId, password);     URL feedUrl = new URL(" https://www.google.com/m8/feeds/contacts /"+gmailId+" /full ");         ContactFeed resultFeed = myService.getFeed(feedUrl, ContactFeed.class);           for (int i = 0; i < resultFeed.getEntries().size(); i++) {       ...

Set Alarm watch using Swing

Here you can set the alarm using swing, see the code here ------------------------------------------------------------ package example.alarm; import java.awt.*; import java.awt.event.*; import java.text.SimpleDateFormat; import java.util.*; import javax.swing.*; class AlarmDemo extends Thread{ private JLabel timeLabel; public AlarmDemo(JLabel label){    this.timeLabel=label;}         public void run(){       while(true){          Date d=new Date();          int h=d.getHours();          String time="PM";          if (h>23){h-=24; time="AM";}          timeLabel.setText(""+h+":"+d.getMinutes()+":"+d.getSeconds()+"  "+time);          try{Thread.sleep(1000);}  catch(Exception e){}       ...

Sarkari Jobs , Public Sector Jobs , IT Jobs , Pharma Jobs , Defence Jobs: Fresher-Hiring-201-Passed-out

Sarkari Jobs , Public Sector Jobs , IT Jobs , Pharma Jobs , Defence Jobs: Fresher-Hiring-201-Passed-out : Hiring Fresher Hiring Fresher - BE\Btech(2011 passed out), Preferable _ ERP Knowledge, Contact at jobs@3leads.com \ sudha@3leads.com