Tuesday, September 27, 2016

To get current timezone of user using javascript.

<!DOCTYPE html>
<html>
    <head>
        <title>To get current timezone of user using javascript.</title>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.j...
        <script type="text/javascript">
               $(document).ready(function() {
                    var tz = jstz.determine();
                    var timezone = tz.name();
                    document.cookie="user_time_zone=" + timezone;    
               });
        </script>
    </head>
</html>

Monday, April 28, 2014

Google map.. Get straight path between two markers

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="" dir="ltr">
<head lang="" dir="ltr">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false&amp;libraries=geometry"></script>
<script>
function initialize() {
        if(jQuery('#address1').val()!=''){
            var position = jQuery('#address1').val().split(",");
            var g_lat1= parseFloat(position[0]);
            var g_long1=parseFloat(position[1]);
        }
        var mapOptions = {
            zoom: 4,
            center: new google.maps.LatLng(g_lat1,g_long1),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById('map-canvas'),
        mapOptions);
        map.controls[google.maps.ControlPosition.TOP_CENTER].push(
        document.getElementById('info'));
        if(jQuery('#address1').val()!=''){
            var position = jQuery('#address1').val().split(",");
            var lat1= parseFloat(position[0]);
            var long1=parseFloat(position[1]);
            marker1 = new google.maps.Marker({
                map: map,
                draggable: false,
                position: new google.maps.LatLng(lat1.toFixed(2),long1.toFixed(2))
            });
        }else{
            marker1 = new google.maps.Marker({
                map: map,
                draggable: false,
                position: new google.maps.LatLng(geoip_latitude(),geoip_longitude())
            });
        }
        if(jQuery('#address1').val()!=''){
            var iw = new google.maps.InfoWindow({
                content: '<div style="overflow:hidden">'+jQuery('#content1').val()+'</div>'
            });
        }else{
            var iw = new google.maps.InfoWindow({
                content: '<div style="overflow:hidden">'+geoip_city()+','+geoip_region_name()+','+geoip_country_name()+'</div>'
            });
        }
        google.maps.event.addListener(marker1, "click", function (e) { iw.open(map, this); });
        if(jQuery('#address2').val()!=''){
            var position1 = jQuery('#address2').val().split(",");
            var lat2= parseFloat(position1[0]);
            var long2= parseFloat(position1[1]);
            marker2 = new google.maps.Marker({
                map: map,
                draggable: false,
                position: new google.maps.LatLng(lat2.toFixed(2),long2.toFixed(2))
            });
        }else{
            marker2='';
        }
        var iw1 = new google.maps.InfoWindow({
            content: '<div style="overflow:hidden">'+jQuery('#content2').val()+'</div>'
        });
        google.maps.event.addListener(marker2, "click", function (e) { iw1.open(map, this); });
        var bounds = new google.maps.LatLngBounds(marker1.getPosition(),
        marker2.getPosition());
        map.fitBounds(bounds);
        zoomChangeBoundsListener =
            google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
            if (this.getZoom()){
                this.setZoom(4);
                var LatLngList = [new google.maps.LatLng (lat1,long1), new google.maps.LatLng  (lat2,long2)];
                var bounds = new google.maps.LatLngBounds ();
                for (var i = 0, LtLgLen = LatLngList.length; i < LtLgLen; i++) {
                    bounds.extend (LatLngList[i]);
                }
                map.fitBounds (bounds);
            }
        });
        setTimeout(function(){google.maps.event.removeListener(zoomChangeBoundsListener)}, 1000);
        var geodesicOptions = {
            strokeColor: '#CC0099',
            strokeOpacity: 1.0,
            strokeWeight: 3,
            geodesic: true,
            map: map
        };
var lineSymbol = {
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
strokeOpacity: 1,
scale: 2
 };
        geodesicPoly = new google.maps.Polyline({
strokeOpacity: 0,
icons: [{
 icon: lineSymbol,
 offset: '0',
 repeat: '20px'
}],
map: map
});
        update();

    }
    function update() {
        var path = [marker1.getPosition(), marker2.getPosition()];
        geodesicPoly.setPath(path);
        var heading = google.maps.geometry.spherical.computeHeading(path[0],
        path[1]);
    }
    google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas" style="width:600px;height:600px;"></div>
<input type="hidden" id="address1" value="23.070611,72.621646">
<input type="hidden" id="address2" value="1.3644202,103.99153079999996">
<input type="hidden" id="content1" value="Ahmedabad, India (AMD)">
<input type="hidden" id="content2" value="Changi Airport Singapore (SIN), Airport Boulevard, Singapore">
</body>
</html>

Saturday, April 19, 2014

Facebook share functionality

<html>
<head>
<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
<script type="text/javascript">
window.fbAsyncInit = function()
{
    FB.init({
        appId  : '420388744727086',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml  : true , // parse XFBML
        oauth : true // Enable oauth authentication
    });


};

function post_on_wall()
{
    FB.login(function(response)
    {
        if (response.authResponse)
        {
            var opts = {
                message : "Hello",
                name : 'Post Title',
                link : 'www.postlink.com',
                description : 'post description',
                picture : 'http://2.gravatar.com/avatar/8a13ef9d2ad87de23c6962b216f8e9f4?s=128&amp;d=mm&amp;r=G'
            };

            FB.api('/me/feed', 'post', opts, function(response)
            {
                if (!response || response.error)
                {
                    alert('Posting error occured');
                }
                else
                {
                    alert('Success - Post ID: ' + response.id);
                }
            });
        }
        else
        {
            alert('Not logged in');
        }
    }, { scope : 'publish_stream' });
}
</script>
<div id="fb_div">
    <h3>Post to your Facebook wall:</h3> <br />
    <input type="button" value="Post on Wall" onClick="post_on_wall();" />
</div>
<div id="fb-root"></div>
</html>

Friday, April 18, 2014

Display image after selecting image using jquery

<!DOCTYPE html>

<html>

<head>

<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />

<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>

<meta charset=utf-8 />

<title>JS Bin</title>

<!--[if IE]>

 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

<![endif]-->

<style>

 article, aside, figure, footer, header, hgroup, 

 menu, nav, section { display: block; }

</style>

<script>

function readURL(input) {

if (input.files && input.files[0]) {

var reader = new FileReader();


reader.onload = function (e) {

$('#blah')

.attr('src', e.target.result)

.width(150)

.height(200);

};


reader.readAsDataURL(input.files[0]);

}

}

</script>

</head>

<body>

 <input type='file' onchange="readURL(this);" />

<img id="blah" src="#" alt="your image" />

</body>

</html>

Monday, March 31, 2014

Facebook Like funtionality using javascript

<html>
<head>
<title>Facebook Like</title>
   <script>
(function(d, s, id) {
         var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
       js.src =   "http://connect.facebook.net/en_US/all.js#xfbml=1&appId=365679273577837";
     fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</head>
<body>
<div class="fb-like" data-href="https://www.google.co.in" data-layout="standard" data-action="like" data-show-faces="false" data-share="false" ></div>
</body>
</html>

Sharing functionality on Social Media using javascript

<html>
<head>
 <title>Social Media Sharing</title>
 <script type="text/javascript">
var url_1 = "https://www.google.co.in" ;
// Twitter Tweet
function goTwitter(title) {
var w = (screen.width-450)/2;
var h = (screen.height-450)/2;
var href = "http://twitter.com/share?text=" + encodeURIComponent(title)+"\n&media_url=http://www.fbrell.com/f8.jpg&url=" + encodeURIComponent(url_1);
var a = window.open(href, 'twitter', 'width=450,height=450,left='+w+',top='+h+',scrollbars=0');
if(a) { a.focus(); }
}
// Google Plus Share
function goGoogle(title, link) {
var w = (screen.width-450)/2;
var h = (screen.height-450)/2;
var href = "https://plus.google.com/share?url="+url_1;
var a = window.open(href, 'google', 'width=450,height=450,left='+w+',top='+h+',scrollbars=0');
if(a) { a.focus(); }
}
// Pinterest Share
function goPinterest(title, link) {
var w = (screen.width-450)/2;
var h = (screen.height-450)/2;
var href = "http://pinterest.com/pin/create/button/?url="+url_1+"&media=http://www.fbrell.com/f8.jpg&description=Google";
var a = window.open(href, 'Pinterest', 'width=750,height=450,left='+w+',top='+h+',scrollbars=0');
if(a) { a.focus(); }
}
// Facebook Share
function pstFaceBook(title,summary,image) {
var d = encodeURIComponent(title);
var image;
if(image!=""){
image = "&p[images][0]="+image;
}else{
image = "";
}
window.open('http://www.facebook.com/sharer.php?s=100&p[url]=' + encodeURIComponent(url_1)+"&p[title]=hello&p[summary]="+summary,"share",'resizable=no width=600 height=400');
}
</script>
</head>
<body>
<a href="javascript:pstFaceBook('Google','Google Home Page','http://www.fbrell.com/f8.jpg');" title="Facebook Share"><img src="http://ijustdid.org/wp-content/uploads/2012/11/Facebook-Share-Button-for-Mobile-300x132.jpg" width="100" height="50"alt="Facebook Share"></a>
<br/>
 <a href="javascript:goTwitter('Gogole');" title="Twitter"><img src="http://www.mediabistro.com/alltwitter/files/2011/05/tweet-button.jpg" width="100" height="70"alt="Twitter"></a>
 <br/>
 <a href="javascript:goGoogle('Name Collection','urlName');" title="Google Share"><img src="http://marketingland.com/wp-content/ml-loads/2013/11/new-gplus-share-button.png" width="100" height="30"alt="Google Share"></a>
 <br/>
 <br/>
 <a href="javascript:goPinterest('Name Collection','urlName');" title="Pinterest Pint"><img src="http://www.nextgenerationchiropractor.com/wp-content/uploads/2013/03/pinterest_pin-it_icon.png" width="100" height="30"alt="Pinterest Pint"></a>
</body>
</html>

Wednesday, February 5, 2014

Search word using third party API (Just like Google Search)

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Autocomplete - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <script>
  $(function() {
 $('#tags').on('keyup', function(e) {
search_content($(this).val());
 });
  });
  function search_content(value){
var split_data=value.replace("+", " ");
$.ajax({
type: 'POST',
url: "http://en.wikipedia.org/w/api.php?action=opensearch&search="+split_data+"&namespace=0",
async: false,
cache: false,
crossDomain: true,
dataType: 'jsonp',
success: function( data, status ) {
var availableTags = [];
$.each(data, function(index, element) {
for(var i=0;i<element.length;i++){
availableTags.push(element[i]);
}
});
$('#tags').autocomplete({
source: availableTags
}); }
});
  }
  </script>
</head>
<body>

<div class="ui-widget">
  <label for="tags">Search Content: </label>
  <input id="tags">
</div>
</body>

</html>

Monday, November 25, 2013

Print the page using javascript

<!DOCTYPE html>
<html>
<HEAD>
<title>Print the page using javascript</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function varitext(){
var printContents = document.getElementById('printtext').innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
//  End -->
</script>
<!-- Remove header and footer text in the print page -->
<style>
@media print {
 @page { margin: 0; }
 body { margin: 1.6cm; }
}
.printtext-content{
border:1px solid #000;
padding:10px;
font-weight:bold;
}
.printtext-content .content-title{
text-align: center;
text-decoration: underline;
font-size: 24px;
}
</style>
</HEAD>
<BODY>
<div >
<div id="printtext">
<div class="printtext-content">
<p><div class="content-title">SAYONARA</div></p>
<p>
As a number of you already know that today is my last day @IndiaNIC . It's hard to imagine that I won't be coming here from tomorrow. Things will be different, life won't be the same.
</p>
<p>
Everybody comes office to work , to gain knowledge , to make money  . but it;s the friends and colleagues who give me strength to come everyday at the same place and do the same thing again and again . i made life long friends @IndiaNIC, which is the only thing i cherish about.
</p>
<p>
I want you all to know that I am truly leaving here with mixed feelings; happy about my new career opportunity (really happy), but sad to be leaving such a wonderful friends and colleagues. The last   years as a member of IndiaNIC was the best period of my career so far.
</p>
</div>
</div>
<form>
<INPUT NAME="print" TYPE="button" VALUE="Print this Document!" ONCLICK="varitext()">
</form>
</div>
</html>

Thursday, November 21, 2013

Simple banner rotator with jQuery

 <!DOCTYPE html>
<html>
  <head>
   <!--Included jquery script library-->
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript">
      $(window).load(function() {
        startRotator("#rotator");
      })
//Initialise rotate js
 function rotateBanners(elem) {
 var active = $(elem+" img.active");
 var next = active.next();
 if (next.length == 0)
next = $(elem+" img:first");
 active.removeClass("active").fadeOut(200);
 next.addClass("active").fadeIn(200);
}

function prepareRotator(elem) {
 $(elem+" img").fadeOut(0);
 $(elem+" img:first").fadeIn(0).addClass("active");
}

function startRotator(elem) {
 prepareRotator(elem);
 setInterval("rotateBanners('"+elem+"')", 2000);
}
</script>
<!-- Initialise rotate css -->
<style>
#rotator img { position: absolute; }
</style>
  </head>
<body>
 <!-- Rotator images -->
  <div id="rotator">
    <img height="154" src="C:\Users\Public\Pictures\Sample Pictures\Autumn Leaves.jpg" width="550" />
    <img height="154" src="C:\Users\Public\Pictures\Sample Pictures\Garden.jpg" width="550" />
    <img height="154" src="C:\Users\Public\Pictures\Sample Pictures\Green Sea Turtle.jpg" width="550" />
    <img height="154" src="C:\Users\Public\Pictures\Sample Pictures\Autumn Leaves.jpg" width="550" />
    <img height="154" src="C:\Users\Public\Pictures\Sample Pictures\Garden.jpg" width="550" />
    <img height="154" src="C:\Users\Public\Pictures\Sample Pictures\Green Sea Turtle.jpg" width="550" />
   
  </div>
</body>
</html>

Wednesday, October 30, 2013

Generate .csv file using PHP

<?php
           // Set label with comma separated
            $str='';
            $str.="tracking_name,origin_zipcode,destination_zipcode,price,customername,orderid,
                       alt_email_id";
            $str .="\n";
          // Set value with comma separated
            $str .="BR76646474RT,5874,2564,150,jaoun brend,ID6353653,admin@admin.com";
            $str .="\n";
            $str .="BR76646474RT,5874,2564,150,jaoun brend,ID6353653,admin@admin.com";
         
          // Set header for download file
            header("Expires: 0");
            header("Cache-control: private");
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Content-Description: File Transfer");
            header("Content-Type: application/vnd.ms-excel");
            header("Content-type: text/x-csv");
            header("Content-Disposition: attachment; filename=rastreamento_detalhado.csv");
            print $str;
            exit;
?>


Tuesday, October 22, 2013

Resize image using PHP

<?php
//  Include the class
include("resize-class.php");
//  1) Initialise / load image
$resizeObj = new resize('sample.jpg');
//  2) Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage(200, 200, 'crop');
//  3) Save image
$resizeObj -> saveImage('sample-resized.jpg', 100);
?>

Thursday, October 17, 2013

Upload multiple image in PHP

<html>
<head>
<title>Multi Image Upload</title>
<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript">
var i=1;
function fnaddimage(){
if(i<5){
$('#check').before('<div id="addimage"><div class="select-image"><input type="file" name="image[]"></div><input type="button" value="Remove" onclick="fnremoveimage(this)"></div></div>');
i++;
}
}
function fnremoveimage(intI){
$(intI).parent().remove();
i--;
}
</script>
<style>
.select-image{float:left}
</style>
</head>
 <body>
<?php
if(!empty($_POST)){
for($i=0;$i<count($_FILES["image"]["name"]);$i++){
$fileData = pathinfo(basename($_FILES["image"]["name"][$i]));
if($fileData['extension']=='jpg' || $fileData['extension']=='png' || $fileData['extension']=='gif' || $fileData['extension']=='jpeg'){
$target_path = $_SERVER['DOCUMENT_ROOT'].'upload/'.$fileData['basename'];
move_uploaded_file($_FILES["image"]["tmp_name"][$i], $target_path);
}
else
{
echo "There was an error uploading the file {$_FILES['image']['name'][$i]}, please try again!<br />";
}
}
}
?>
<form enctype="multipart/form-data" action="multiimage.php" method="POST">
<div>
<div id="addimage">
<div class="select-image"><input type="file" name="image[]"></div>
<div class="btn-image">
<input type="button" value="Add" onclick="fnaddimage()">
</div>
</div>
<div id="check"></div>
<input type="submit" name="Upload" value="Upload">
</div>
</form>
 </body>
</html>

Tuesday, October 8, 2013

Flash Player Timer

<html>
<head>
<title>Flash Timer</title>
</head>
<body>
 <object align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" height="180" id="main" width="176">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="http://beta.theonepoint.net/public/images/hquiz/main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<param name="FlashVars" value="sec=60&id=2" />
<embed src="http://beta.theonepoint.net/public/images/hquiz/main.swf"
width="176"
height="180"
autostart="false"
quality="high"
bgcolor="#ffffff"
FlashVars="sec=60&id=2"
name="main"
align="middle"
wmode="transparent"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>


Wednesday, October 2, 2013

Get Days,Months,Years,Hours,Minutes and Seconds between Dates in PHP

<?php 

// First Date
$exp_date = date("Y-m-d",strtotime('2013-09-24 16:20:00'));

//Second Date
$del_date = date("Y-m-d",strtotime('2013-09-30 11:54:47'));

$datetime1 = date_create($exp_date);
$datetime2 = date_create($del_date);

$interval = date_diff($datetime1, $datetime2);

//Display all parameters with value
print "<pre>";
print_r($interval);

?>

Tuesday, September 24, 2013

Highcharts "Bar Chart" with download chart image functionality

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html debug="true">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script type="text/javascript">
(function($){ // encapsulate jQuery
$(function () {
        $('#container').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Monthly Average Rainfall'
            },
            subtitle: {
                text: 'Source: WorldClimate.com'
            },
            xAxis: {
                categories: [
                    'Jan',
'Feb',
'Mar',
                   
                ]
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Rainfall (mm)'
                }
            },
            tooltip: {
                headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
                pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                    '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                name: 'Tokyo',
                data: [49.9, 71.5, 106.4]
   
            }]
        });
    });
   
})(jQuery);
</script>
</head>
<body>
<div id="demo-content">
<div style="margin: 5px">
              <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</div>
</div>
</body>
</html>

Generate PDF using PHP code

// First Download  "DOMPDF" Library 


//Use this code
<?php

 require_once('/libraries/dompdf/dompdf_config.inc.php');
          $html =
                '<html><body>'.
                '<p>Hello World!</p>'.
                '</body></html>';
         $dompdf = new DOMPDF();
         $dompdf->load_html($html);
         $dompdf->render();
         $dompdf->stream("hello_world.pdf");
?>

Saturday, September 21, 2013

Get .csv file contents using php

$fp = fopen('D:\wamp\www\hmvcExample\img\upload\retest.csv','r') or die("can't open file");
while($csv_line = fgetcsv($fp,1024)) {
    for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
        $csv_line[$i];
    }
$total_data[]=$csv_line;
}
fclose($fp) or die("can't close file");

Tuesday, September 17, 2013

Examples of Jwplayer (audio and video player)

<HTML>
<HEAD>
<TITLE>Jwplayer Player Javascript Kit</TITLE>
<script language='javascript' src='jwplayer.js'></script>
</HEAD>
<BODY>
<div id="mediaplayer_joke_1"></div>
<script type="text/javascript">
 jwplayer('mediaplayer_joke_1').setup({
'flashplayer': 'player.swf',
'width': '300',
'height': '24',
'autostart': 'false',
'file': 'example1.mp3',
'controlbar': 'bottom'
 });
</script>
</BODY>
</HTML>

Wednesday, September 11, 2013

Sticky notes made by css

<html>
<head>
<title>Sticky Note</title>
<style>
.sticky {
 -webkit-box-shadow: #DDD 0px 1px 2px;
 position: fixed;
 background-color: #F4F39E;
 border-color: #DEE184;
 text-align: center;
 margin: 2.5em 0px;
 padding: 1.5em 1em;
 -webkit-box-shadow: 0px 1px 3px rgba(0,0,0,0.25);
 -moz-box-shadow: 0px 1px 3px rgba(0,0,0,0.25);
 box-shadow: 0px 1px 3px rgba(0,0,0,0.25);
 font-family: Chalkboard, 'Comic Sans';
}
.sticky.taped:after {
 display: block;
 content: "";
 position: absolute;
 width: 151px;
 height: 35px;
 top: -21px;
 left: 25%;  
 background: transparent url(tape.png) 0 0 no-repeat;
}
</style>
</head>
<body>
<p class="sticky taped" style="width: 250px;">
 <strong>The Little Turtle</strong>.<br />
 There was a little turtle.<br />
 He lived in a box.<br />
 He swam in a puddle.<br />
 He climbed on the rocks.<br />
 —Vachel Lindsay
</p>
</body>
</html>

Wednesday, August 7, 2013

Change word in given string using Jquery and enter new line in textarea

<html>

<head>

<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>

<script language="JavaScript" type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>

<script>

var f_name='';

function fnformname(){  

var from_name_val = $("#from_name").val();  

if(from_name_val!=''){   

if(f_name!=''){    

var emailcontent_val_data = $("#emailcontent").val();    

var final_data = emailcontent_val_data.split(f_name).join(from_name_val);    

$("#emailcontent").val(final_data);    

f_name=from_name_val;   

}   

else {    

var emailcontent_val_data = $("#emailcontent").val();    

var final_data = emailcontent_val_data.split('<fromname>').join(from_name_val);    $("#emailcontent").val(final_data);    

f_name=from_name_val;   

}   

return true;  

}

</script>

<head>

<body>

<?php$mail_data = "Hello,\n<fromname> has sent you a link to install the app on your device."?>

<div class="fieldtext-box cf">  

<div class="fieldtext alignleft">    

<label for="email">From Name</label>    

<input type="text" name="from_name" id="from_name" onblur="return fnformname()" />  

</div>  

<div class="fieldtext alignleft">   

<label for="email" class="email-text-label" style="vertical-align:top">Email Text</label>   

<textarea rows="5" cols="40" id="emailcontent" class="email-text" name="emailcontent" ><?php echo $mail_data;?></textarea>  

</div>

</div>

</body>

</html>