4/11/2012

Make an iFrame reload using javascript

see the following code bellow

   1:  var myIframe = document.getElementsByTagName("iframe")[0];
   2:   
   3:  myIframe.contentWindow.location.reload();

Save And Share :

Compare two objects DateTime (C#)

Writing new method to reuse compare the date of two objects with below code

   1:  public static bool IsSameDayAs(DateTime a, DateTime b)
   2:  {
   3:    return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day;
   4:  }

So now we can easy use the method like example

   1:  DateTime regDate = …
   2:   
   3:  if(regDate.IsSameDayAs(DateTime.Now)){
   4:    //do something or alert message
   5:  }

Save And Share :

How to find internal/external links in Web with jQuery

1. Find all internal links

   1:  $("a[href^='/'],a[href*='"+location.hostname+"']") 

2. Find all external links

   1:  $("a[href*='http://']:not([href*='"+location.hostname+"'])") 

--> Using to change style automatic

   1:  $(document).ready(function() {
   2:      $("a[href*='http://']:not([href*='" + location.hostname + "']),[href*='https://']:not([href*='" + location.hostname + "'])").attr("target", "_blank").attr("title", "Opens new window").addClass("external");
   3:   
   4:  });
 

Save And Share :

Quick short writing $(document).ready() in jQuery

A best shorten way for  $(document).ready() is using

   1:  $(function() {  
   2:      //Do something here  
   3:  });

Save And Share :

Hello World !

My first blog post in English :) so everyone in the world can be understand.

Save And Share :

 
  • Followers