Scroll to bottom in chat box for previous messages

<style>
#amit
{
 float:left;
 height:200px;
 width:300px;
 border:1px solid;
 overflow-y:scroll
}
</style>

<script>
$(document).ready(function(){

$("#amit").animate({ scrollTop: $(document).height() }, 0000);

});
</script>

<div id="amit">
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>
        Text text<br>

</div>

Countdown timer for online exam

<form name="counter">
<input type="text" size="8" name="d1">
<input type="text" size="8" name="d2">
<input type="hidden" size="8" name="d3">
</form>

<script>
<!--
//
 var milisec=0
 var seconds=60
var minutes=2
 document.counter.d2.value='60'

function display(){


 if (milisec<=0){
    milisec=10
    seconds-=1
 }
 if (milisec<=0){
    milisec=0
    seconds-=1
 }

 if (seconds<=0){
 seconds=60
    minutes-=1
   
 }
 if (minutes<=0){
 milisec=0
 seconds=0
    minutes=0
 } 

 else
    milisec-=1
    document.counter.d1.value=minutes
    document.counter.d2.value=seconds
    document.counter.d3.value=milisec
    setTimeout("display()",100)
}
display()
-->
</script>

Automatically submit a form using javascript

<form id="myForm" name="myForm" action="http://example.com/examplePage.do" method="POST">
<input type=text name="val1" id="val1" value="value1"/>
<input type=text name="val2" id="val2" value="value2"/>
<input type=text name="val3" id="val3" value="value3"/>
<input type=text name="submit" id="submit" value="Continue"/>
</form>

<html>
<body onload="document.createElement('form').submit.call(document.getElementById('myForm'))">
<form id="myForm" name="myForm" action="http://example.com/examplePage.do" method="POST">
<input type=hidden name="val1" id="val1" value="value1"/>
<input type=hidden name="val2" id="val2" value="value2"/>
<input type=hidden name="val3" id="val3" value="value3"/>
<input type=hidden name="submit" id="submit" value="Continue"/>
</form>
</body>
</html>

How to Import large sql file to WAMP/phpmyadmin?

Step 1: Find the config.inc.php file located in the phpmyadmin directory. In my case it is located here:

C:\wamp\apps\phpmyadmin3.4.5\config.inc.php 

Note: phymyadmin3.4.5 folder name is different in different version of wamp

Step 2: Find the line with $cfg['UploadDir'] on it and update it to:

$cfg['UploadDir'] = 'upload';

Step 3: Create a directory called ‘upload’ within the phpmyadmin directory.

C:\wamp\apps\phpmyadmin3.2.0.1\upload\

Step 4: Copy and paste the large sql file into upload directory which you want importing to phymyadmin

Step 5: Select sql file from drop down list from phymyadmin to import.

Seconds Countdown timer with jquery

<p>You'll be automatically redirected in <span id="count">10</span> seconds...</p>

<script type="text/javascript">

window.onload = function(){

(function(){
  var counter = 10;

  setInterval(function() {
    counter--;
    if (counter >= 0) {
      span = document.getElementById("count");
      span.innerHTML = counter;
    }
    // Display 'counter' wherever you want to display it.
    if (counter === 0) {
        alert('this is where it happens');
        clearInterval(counter);
    }

  }, 1000);

})();

}

</script>

<meta http-equiv="refresh" content="10;url=http://www.example.com" />

How to get the selected value of dropdownlist using JavaScript?



<select id="v1">
<option>amit</option>
<option>work</option>
<option>desk</option>
</select>
<button>Click</button>

$(document).ready(function(){
$('button').click(function(){
var s = document.getElementById('v1');
var v1 = s.options[s.selectedIndex].value;
    alert(v1);
});
});

How to get post thumbnail in wordpress?

<?php 
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  the_post_thumbnail();
} 
?>
<?php the_content(); ?>

this is the default method to retrieve post thumbnail
<?php 
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  the_post_thumbnail(array(150,150));
} 
?>
<?php the_content(); ?>
this is the method which is used to alter that thumbnail like size in array 150px & 150px