Wednesday, 16 October 2013

Browser close & Redirection event in Javascript.

Browser close & Redirection  event in Javascript.

window.onbeforeunload = function(e) {
    // check condition
        alert('Close');
     

    };

Monday, 7 October 2013

Checking if URL contains "HTTP" OR "HTTPS"

Checking if URL contains "HTTP" OR "HTTPS"

Code
<?php
    $site = "https://www.abc.com?id=123&r=sdsdsdsdd";
    $url = parse_url($site);
    if(in_array("http", $url) || in_array("https", $url)) {
        echo "Present";
    }
    else{
    echo "Not Present";
    }
?>

Note:  parse_url : Parse URL ans returns its components.

OUTPUT: 

Present

Friday, 4 October 2013

Table row and CSS

HTML:
A B C
Cell #1 Cell #2 Cell #3
Cell #4 Cell #5 Cell #6
Cell #7 Cell #8 Cell #9

<table border="2" class="text_12">
<tr>
    <td>A</td>
    <td>B</td>
    <td>C</td>
</tr>
<tr>
    <td>Cell #1</td>
    <td>Cell #2</td>
    <td>Cell #3</td>
</tr>
<tr>
    <td>Cell #4</td>
    <td>Cell #5</td>
    <td>Cell #6</td>
</tr>
<tr>
    <td>Cell #7</td>
    <td>Cell #8</td>
    <td>Cell #9</td>
</tr>
</table>


CSS:
<style>
table.text_12 tr td:nth-child(2){
    background-color:red;
}
table.text_12 tr+tr td:nth-child(1){
    background-color:green;
}
</style>