Client-side Table Sorting Using Javascript
Sort column/field data in ascending / descending order while maintaining row data with the help of JavaScript only. So, no server-side script and no page refresh.
Sort column/field data in ascending / descending order while maintaining row data with the help of JavaScript only. So, no server-side script and no page refresh.
Here when an user click on a text link “select all”, all the contents of the textarea will be highlighted. You can use onclick event directly on textarea also.
<script type=”text/javascript”>
function select_all(element1) {
// first set focus
document.frm1.elements[element1].focus();
// select all contents
document.frm1.elements[element1].select();
}
</script>
<form name=”frm1″>
<a href=”#” onclick=”select_all(‘desc’)”>Select all</a>
<textarea name=”desc” cols=”50″ rows=”7″></textarea>
</form>
JavaScript show hide code hiding and showing any elements including popular div, p. Good toggle view functionality that consider input values when you hide it.
PHP code for directly removing duplicate entry in Array and also test only script to check duplicate value in array
You will use “print_r” and “foreach” many times during programming at the time of using array.
<?php
$arr3 = array(‘a’, ‘b’, ‘c’, ‘d’);
echo ‘<pre>’;
print_r($arr2);
echo ‘</pre>’;
?>
print_r() will print whole array with key=>value pair in human readable format.
Delete every item, but not array
foreach ($arr3 as $key=>$value) {
unset($arr3[$key]);
}
foreach is specifically made for array. It provides an easy way to traverse [...]
Array Syntax:
array ([key=>] value,)
Key may be an integer or string, and value may be any value.
<?php
$arr1 = array (‘lang’=>’php’, 1=>true, 13);
echo $arr1['lang'] ; // print php
echo $arr1[1]; // 1
echo $arr1[2]; // 13
?>
As you can see above string ‘key’ is quoted.
An array [...]