article

Thursday, December 22, 2011

Contact Form Using Jquery-Ajax

Contact Form Using Jquery-Ajax

Create a jquery ajax form and validate the fields

Download











CSS
body{
font-family:Arial, Tahoma, Verdana;
font-size:12px;
margin:0 auto; padding:0;
color:#FFFFFF;
background-color:#949494;
}
*{
margin:0;
padding:0;
}
*:focus{
outline:none; /* removes ugly dotted border but may make template more unsuable, up to you
if you want to keep it! */
}
.clr{
clear:both
}
form{
margin:0; padding:0;
}

/* links */
a{
color:#a2a1a1;
text-decoration:underline;
}
a:visited{
color:#a7a6a6;
text-decoration:none;
}
a:hover{
color:#a7a6a6;
text-decoration:none;
}
a img{
border:none
}

/* Custom Message Styling */
.info {
margin: 15px 0;
color: #478BBF;
padding: 8px 10px 8px 37px;
background: #DCEFF5 url(images/info.png) 12px 9px no-repeat;
border: 1px solid #B8E7F5;
}
.success {
margin: 15px 0;
color:#3F9153;
padding:8px 10px 8px 37px;
background:#D7F7DF url(images/success.png) 12px 9px no-repeat;
border:1px solid #A3F7B8
}
.error {
margin: 15px 0;
color: #C24848;
padding: 8px 10px 8px 37px;
background: #FFD6D6 url(images/error.png) 12px 9px no-repeat;
border: 1px solid #FFC2C2;
}
.warning {
margin: 15px 0;
color: #CF9E00;
padding: 8px 10px 8px 37px;
background: #FAF2D7 url(images/warning.png) 12px 9px no-repeat;
border: 1px solid #FAE8AF;
}


#content{
padding:50px 0px 50px 0px;
}
#content_main{
width:560px;
float:left;
padding-left:30px;
}
.title_page{
font-size:36px;
margin-bottom:0;
}
.desc_title{
color:#FFFFFF;
font-size:24px;
}

form{
margin:0;
padding:0;
}
#contact_area{
position:relative;
padding:0px 0 0 0;

}
#contactFormArea{
width:406px;
margin:-20px 0px 20px 0px;
padding:30px 0 0 0;
}
label{
margin-bottom:3px;
}
fieldset{
border:0px;
}
.textfield{
border:1px solid #d5d5d5;
font-size:12px;
width:406px;
padding:7px 5px;
margin:0px 0px 15px 0px;
color:#959494;
}
.input-submit{
background-image:url(images/but-send.jpg);
background-repeat:no-repeat;
border:none;
width:84px;
height:34px;
cursor:pointer;
float:right;
margin-top:10px;
margin-right:-12px\0/;
color:#959494;
font-size:13px;
text-shadow:0px 1px 0px #fff;
}

/* ie7 hack */
*:first-child+html .input-submit{
background-image:url(images/but-send.jpg);
background-repeat:no-repeat;
border:none;
width:84px;
height:34px;
cursor:pointer;
float:right;
margin-top:10px;
margin-right:-12px;
color:#959494;
font-size:13px;
text-shadow:0px 1px 0px #fff;
}

.textarea{
border:1px solid #d5d5d5;
font-size:12px;
overflow:hidden;
width:406px;
padding:6px 5px;
margin:0px 0px 5px 0px;
color:#959494;
font-family:Arial;
}
.loading{
background:url(images/loading-contact.gif) no-repeat;
background-position:0px 3px;
padding-left:25px;
color:#797979;
margin:19px 20px 0px 0px;
float:right;
}
.success-contact{
text-align:center;
color:#3F9153;
margin-bottom:10px;
padding:8px 10px 8px 37px;
background:#D7F7DF url(images/success.png) no-repeat;
background-position:120px 9px;
border:1px solid #A3F7B8;
}



//Javascript
$(document).ready(function() {
$('#buttonsend').click( function() {

var name = $('#name').val();
var subject = $('#subject').val();
var email = $('#email').val();
var message = $('#message').val();

$('.loading').fadeIn('fast');

if (name != "" && subject != "" && email != "" && message != "")
{

$.ajax(
{
url: 'sendemail.php',
type: 'POST',
data: "name=" + name + "&subject=" + subject + "&email=" + email + "&message=" + message,
success: function(result)
{
$('.loading').fadeOut('fast');
if(result == "email_error") {
$('#email').css({"border":"1px solid #ffb6b6"}).next('.require').text(' !');
} else {
$('#name, #subject, #email, #message').val("");
$('
Your message has been sent successfully. Thank you!
').insertBefore('#contactFormArea');
$('.success-contact').fadeOut(5000, function(){ $(this).remove(); });
}
}
}
);
return false;

}
else
{
$('.loading').fadeOut('fast');
if( name == "") $('#name').css({"background":"#FFFCFC","border":"2px solid #ffb6b6"});
if(subject == "") $('#subject').css({"background":"#FFFCFC","border":"2px solid #ffb6b6"});
if(email == "" ) $('#email').css({"background":"#FFFCFC","border":"2px solid #ffb6b6"});
if(message == "") $('#message').css({"background":"#FFFCFC","border":"2px solid #ffb6b6"});
return false;
}
});

$('#name, #subject, #email,#message').focus(function(){
$(this).css({"background":"#ffffff","border":"2px solid #d5d5d5"});
});

});


//sendemail.php
<?php
$yourName = 'Test Mail';
$yourEmail = 'info@r-ednalan';
$yourSubject = 'Subject Test';
$referringPage = 'http://r-ednalan.blogspot.com/';
function cleanPosUrl ($str) {
return stripslashes($str);
}
if ( isset($_POST['sendContactEmail']) )
{
$to = $yourEmail;
$subject = $yourSubject.': '.$_POST['posRegard'];
$message = cleanPosUrl($_POST['posText']);
$headers = "From: ".cleanPosUrl($_POST['posName'])." <".$_POST['posEmail'].">\r\n";
$headers .= 'To: '.$yourName.' <'.$yourEmail.'>'."\r\n";
$mailit = mail($to,$subject,$message,$headers);
if ( @$mailit ) {
header('Location: '.$referringPage.'?success=true');
}
else {
header('Location: '.$referringPage.'?error=true');
}
}
?>


<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/contact-form.js"></script>
<div id="content">
<div id="content_main">
<h1 class="title_page">Contact</h1>
<h2 class="desc_title">Send us and email</h2>
<p class="italic-text">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore fugiat nulla pariatur excepteur sint occaecat cupidatat non proident,sunt in culpa quilo officia deserunt mollit anim id est laborum.</p>
<div id="contact_area">
<div id="contactFormArea">
<form action="#" id="contactform">
<fieldset>
<label>Name</label><br />
<input type="text" name="name" class="textfield" id="name" value="" /><br />
<label>Email</label><br />
<input type="text" name="email" class="textfield" id="email" value="" /><br />
<label>Subject</label><br />
<input type="text" name="subject" class="textfield field-nomargin" id="subject" value="" /><br />
<label>Message</label><br />
<textarea name="message" id="message" class="textarea" cols="2" rows="7"></textarea>
<input type="submit" name="submit" class="input-submit" id="buttonsend" value="" />
<span class="loading" style="display: none;">Please wait..</span>
</fieldset>
</form>
</div>
</div>
</div>
</div>





Wednesday, December 14, 2011

Simple CSS Vertical Menu

Simple CSS Vertical Menu

Download





<style type="text/css">
.verticalmenu{
list-style-type: none;
margin: 5px 0;
padding: 0;
width: 200px;
border: 1px solid #9A9A9A;
border-bottom-width: 0;
}
.verticalmenu li a{
background: white url(images/glossyback.gif) repeat-x bottom left;
font: bold 13px "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, sans-serif;
color: white;
display: block;
width: auto;
padding: 10px 0;
padding-left: 10px;
text-decoration: none;
}
* html .verticalmenu li a{ /*IE only. Actual menu width minus left padding of A element (10px) */
width: 160px;
}
.verticalmenu li a:visited, .verticalmenu li a:active{
color: white;
}
.verticalmenu li a:hover{
background-image: url(images/glossyback2.gif);
}
</style>
<ul class="verticalmenu">
<li><a href="#" >r-ednalan.blogspot.com</a></li>
<li><a href="#" >CSS</a></li>
<li><a href="#">Javascript</a></li>
<li><a href="#">HTML5</a></li>
<li><a href="#">Web Design</a></li>
</ul>

Sunday, December 11, 2011

Create CSS Vertical Menu

Create CSS Vertical Menu





<style type="text/css">
.verticalmenu{
width: 190px;
}
.verticalmenu .headerbar{
font: bold 13px Verdana;
color: #000000;
background: #F3CE69 url(arrowstop.gif) no-repeat 8px 6px; /*last 2 values are the x and y coordinates of bullet image*/
margin-bottom: 0; /*bottom spacing between header and rest of content*/
text-transform: uppercase;
padding: 7px 0 7px 31px; /*31px is left indentation of header text*/
border:1px solid #73310A;
}
.verticalmenu ul{
list-style-type: none;
margin: 0;
padding: 0;
margin-bottom: 0; /*bottom spacing between each UL and rest of content*/
}
.verticalmenu ul li{
padding-bottom: 2px; /*bottom spacing between menu items*/
}
.verticalmenu ul li a{
font: normal 12px Arial;
color: black;
background: #FFFBEF;
display: block;
padding: 5px 0;
line-height: 17px;
padding-left: 8px; /*link text is indented 8px*/
text-decoration: none;
border:1px solid #73310A;
}
.verticalmenu ul li a:visited{
color: black;
}
.verticalmenu ul li a:hover{ /*hover state CSS*/
color: #D95A16;
background: #DDDDDD;
}
</style>
<div class="verticalmenu">
<h3 class="headerbar">Tutorials</h3>
<ul>
<li><a href="#">ASP.NET</a></li>
<li><a href="#">DATABASES</a></li>
<li><a href="#">DESIGN</a></li>
<li><a href="#">HTML CSS</a></li>
<li><a href="#">JAVASCRIPT AND AJAX</a></li>
<li><a href="#">PHP</a></li>
<li><a href="#">TOOLS AND TIPS</a></li>
<li><a href="#">PYTON</a></li>
</ul>
</div>

Friday, December 9, 2011

CSS Menu

CSS Menu

Download


<style>
*{
margin:0;
padding:0;
}
#menu_blue{
width:90%;
margin:25px auto;
}
#menu_blue ul{
list-style:none;
}
#menu_blue li{
display:block;
float:left;
}
#menu_blue li a{
background:#e4e8eb url(menu_bg_blue.gif) repeat-x;
border:2px solid #bdc5cd;
margin:0 1px;
padding:15px 15px 15px 15px;
display:block;
float:left;
color:#2b61a1;
text-transform:uppercase;
text-decoration:none;
font-family:Geneva, Arial, Helvetica, sans-serif;
font-size:13px;
font-weight:bold;
height: 50px;
}
#menu_blue li a span{
color:#636363;
font-size:10px;
text-transform:lowercase;
font-family:Geneva, Arial, Helvetica, sans-serif;
font-weight:normal;
}
#menu_blue li a:hover{
background:#e46825 url(menu_hover_blue.gif) repeat-x;
border:2px solid #4a88ce;
text-decoration:none;
}
#menu_blue li a:hover span{
color:#636363;
}
.current_blue{
background:#74befd url(menu_hover_blue.gif) repeat-x;
border:2px solid #4a88ce;
margin:0 1px;
padding:15px 15px 15px 15px;
display:block;
float:left;
color:#2b61a1;
text-transform:uppercase;
text-decoration:none;
font-family:Geneva, Arial, Helvetica, sans-serif;
font-size:13px;
cursor:pointer;
font-weight:bold;
height: 50px;
}
.current_blue span{
color:#636363;
font-size:10px;
text-transform:lowercase;
font-family:Geneva, Arial, Helvetica, sans-serif;
font-weight:normal;
}
</style>
<div id="menu_blue">
<ul>
<li class="current_blue">Home<br /><span>takes you to<br /> home page</span></li>
<li><a href="#">About Us<br /><span>takes you to<br />about us page</span></a></li>
<li><a href="#">Products<br /><span>takes you to<br />products page</span></a></li>
<li><a href="#">Contact Us<br /><span>takes you to<br />contact page</span></a></li>
</ul>
</div>

PHP Smart Image Resizer Script

PHP Smart Image Resizer Script

Smart image resizer is a PHP script which makes it very easy to resize & crop images. And, this is done without touching the original image Compatibility: JPG, GIF, PNG


Website: http://shiftingpixel.com/2008/03/03/smart-image-resizer/

Free CSS Drop-Down Menu Framework

Free CSS Drop-Down Menu Framework

CSS Drop-Down Menu Framework is a free & cross-browser solution to create good looking menus Compatibility: All Major Browsers


Website: http://lwis.net/free-css-drop-down-menu/

Demo: http://lwis.net/free-css-drop-down-menu/dropdown.mtv...

Download: http://free-css-drop-down-menu-framework.googlecode.com/files/free-css-drop-down-menu_v1.2.zip

Tuesday, November 29, 2011

Create Form Styling with CSS3

Create Form Styling with CSS3







<style>
form { width: 460px; padding: 20px; color: #333333; font-family: Verdana, Geneva, sans-serif; font-size: 12px; margin: 0 auto }
fieldset { position: relative; padding: 10px; padding-top: 0; padding-top: 25px\9; margin-bottom: 30px; background: #F6F6F6; -webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius: 8px; background: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), to(#FFFFFF)); background: -moz-linear-gradient(center top, #EFEFEF, #FFFFFF 100%); box-shadow: 3px 3px 10px #ccc; -moz-box-shadow: 3px 3px 10px #ccc; -webkit-box-shadow: 3px 3px 10px #ccc }
legend { padding: 6px 12px; position: absolute; left: 10px; top: -11px; background-color: #4F709F; color: white; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; box-shadow: 2px 2px 4px #888; -moz-box-shadow: 2px 2px 4px #888; -webkit-box-shadow: 2px 2px 4px #888; text-shadow: 1px 1px 1px #333 }
label, span { float: left; clear: left; display: block; width: 180px; padding-right: 20px; text-align: right; height: 20px; line-height: 20px }
input, textarea { padding: 3px; float: left; width: 200px; border: 1px solid #d9d9d9 }
.submit { width: 100px; float: right; margin-right: 37px; border: 0; padding: 5px 10px; background: #4F709F; color: white; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; box-shadow: 2px 2px 4px #888; -moz-box-shadow: 2px 2px 4px #888; -webkit-box-shadow: 2px 2px 4px #888; margin-bottom: 4px; text-shadow: 1px 1px 1px #333 }
textarea { background: -webkit-gradient(linear, left top, left bottom, from(#FFFFFF), color-stop(1%, #EEEEEE), to(#FFFFFF)) }
input:focus, textarea:focus { background: white; border-color: #666 }
p { overflow: hidden; margin-bottom: 10px }
p:first-of-type { padding-top: 25px }
</style>
<form>
<fieldset>
<legend>Details</legend>
<p><label for="name">Name</label><input id="name" type="text" /></p>
<p><label for="email">Email</label><input id="email" type="email" /></p>
<p><label for="telephone">Telephone</label><input id="telephone" type="tel" /></p>
<p><label for="project-details">Additional Details</label><textarea id="project-details" rows="5"></textarea></p>
<p><input class="submit" type="submit" id="submit" value="Submit Form" /></p>
</fieldset>
</form>

A Set Of Pure CSS Animations – Animate.css

A Set Of Pure CSS Animations – Animate.css

Animations like fade in/fade out or bounce are used almost everywhere, thanks to the ease that JS frameworks are offering, to create attractive user experiences.

Website: http://daneden.me/animate/

Download: https://github.com/daneden/animate.css

Creative, CSS3-Powered And Animated Menus

Creative, CSS3-Powered And Animated Menus

10 unique examples, all have the same HTML structure but different CSS styles that make use of CSS transitions and animations.


Website: http://tympanus.net/codrops/2011/10/24/creative-css3...


Demo: http://tympanus.net/Tutorials/CreativeCSS3AnimationM...

Sunday, November 27, 2011

Calculate The Timespan Between 2 Dates: Countdown.js

Calculate The Timespan Between 2 Dates: Countdown.js

Countdown.js is a JavaScript library for calculating and displaying the timespan between two dates.


Website: http://countdownjs.org/

Demo: http://countdownjs.org/demo.html

Friday, November 25, 2011

Create a CSS Tab

Create a CSS Tab

Download Here

<style>
* {padding:0; margin:0;}
body {background:url(images/bg.jpg) repeat; font-family:Georgia, "Times New Roman", Times, serif; color:#212713;}
#wrap {width:1000px; margin:auto;}
#contentwrap {background:url(images/contentbg.gif) repeat-y; padding:10px 0 3px 0;}
#menu {background:url(images/contenttop.gif) center bottom no-repeat; height:44px; padding-bottom:11px;}
#contentbtm {background:url(images/cntntbtm.gif) center no-repeat; height:12px;}
ul {list-style:none;}
#menu li {display:inline; font:bold 22px Comfortaa;}
#menu li a {display:block; height:44px; float:left; background:url(images/menu2.gif) right top no-repeat; margin-right:3px; padding-right:10px; color:#dbe7af; text-decoration:none;}
#menu li a span {display:block; background:url(images/menu1.gif) left top no-repeat; padding:7px 20px 0 30px; height:37px;}
#menu li a:hover {background:url(images/menuh2.gif) right top no-repeat; color:#1b2502; text-shadow:#fff 1px 1px 1px;}
#menu li a:hover span {background:url(images/menuh1.gif) left top no-repeat;}
#menu li.active a {background:url(images/menuh2.gif) right top no-repeat; color:#1b2502; text-shadow:#fff 1px 1px 1px;}
#menu li.active a span {background:url(images/menuh1.gif) left top no-repeat;}
#mainpage {padding:0 10px 10px 10px;}
</style>
<div id="wrap">
<div id="menu">
<ul>
<li class="active"><a href="index.html"><span>Home</span></a></li>
<li><a href="#"><span>About</span></a></li>
<li><a href="#"><span>Contact</span></a></li>
</ul>
</div>
<div id="contentwrap">
<div id="mainpage">
Contents
</div>
</div>
<div id="contentbtm"></div>
</div>

Monday, November 21, 2011

Create Contact Form Design

Create Contact Form Design





<style>
#contactform { margin:0; padding:5px 10px;}
#contactform * { color:#222222;}
#contactform ol { margin:0; padding:0; list-style:none;}
#contactform li { margin:0; padding:0; background:none; border:none; display:block;}
#contactform li.buttons { margin:5px 0 5px 0;}
#contactform label { margin:0; width:110px; display:block; padding:5px 0; font:normal 12px Arial, Helvetica, sans-serif; color:#2c2c2c; text-transform:capitalize;}
#contactform label span { display:block; font:normal 10px Arial, Helvetica, sans-serif;}
#contactform input.text { width:440px; border:1px solid #dcdcdc; margin:5px 0; padding:5px 2px; height:25px; background:#f5f5f5;}
#contactform textarea { width:440px; border:1px solid #dcdcdc; margin:10px 0; padding:2px; background:#f5f5f5;}
#contactform li.buttons input { padding:3px 0; margin:0; border:0; color:#FFF;}
</style>
<h2>Contact form</h2>
<form action="contact.php" method="post" id="contactform">
<ol>
<li>
<label for="name">First Name<a href="#">*</a><br />
</label>
<input name="name" class="text" id="name" />
</li>
<li>
<label for="label2">Your e-mail<a href="#">*</a><br />
</label>
<input id="label2" name="name2" class="text" />
</li>
<li>
<label for="email">Company Name<br />
</label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="label">Subject<br />
</label>
<input id="label" name="email2" class="text" />
</li>
<li>
<label for="message">Message<a href="#">*</a><br />
</label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField2" id="imageField2" src="images/send.gif" />
</li>
</ol>
</form>

Sunday, November 20, 2011

Load Records Using Jquery Json and Mysql

Load Records Using Jquery Json and Mysql

Table

CREATE TABLE `tbljson` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
`image` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;


index.php
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$("document").ready(function () {
$.getJSON('json.php?callback=?', function (data) {
$("#content").html('');
$.each(data, function (i, item) {
$("#content").append('<div class="product"><img src="images/' + item.image + '" width="135" height="138"/><div class="title">' + item.title + '</div><div class="description">' + item.description + '</div><div class="clear"></div></div>');
});
});
$("#content").fadeIn(2000);
});
</script>
<style>
.main{
width:900px;
margin:0 auto;
}
.product{
width:300px;
float:left;
margin:10px;
border:1px #dedede solid;
padding:5px;
background-image:url(images/corner.jpg);
background-position:bottom right;
background-repeat:no-repeat;
}
.product .title{
margin-bottom:6px;}
.product img{
float:left;
margin-right:10px;
border:1px solid #dedede;}
.product .description{font-size:10px; font-family:Geneva, Arial, Helvetica, sans-serif}
</style>
<div class="main">
<div id="content"><img src="images/ajax-loader.gif" alt="Loading..." /></div>
</div>
<div class="clear"></div>



jason.php
<?php
include('connect.php');
$sql = "SELECT title, image, description FROM tbljson LIMIT 4";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$rows[] = array(
"title" => $row['title'],
"image" => $row['image'],
"description" => $row['description']);
}

$json = json_encode($rows);
$callback = $_GET['callback'];
echo $callback.'('. $json . ')';
?>


connect.php
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "ednalan";
$dbname = "test";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Error connecting to database");
mysql_select_db($dbname);
?>

Thursday, October 20, 2011

Disable Browser Back Button Using Javascript

Disable Browser Back Button Using Javascript






<HTML>
<HEAD>
<TITLE>Disable Back Button in Browser </TITLE>
<script type="text/javascript">
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
</HEAD>
<body onload="disableBackButton()">
<p>This page contains the code to avoid Back button.
</p>
<p>Click here to Goto <a href="noback.html">NoBack Page</a>
</p>
</BODY>
</HTML>

Tuesday, October 11, 2011

Hover Fading button with jQuery

Hover Fading button with jQuery

Demo


<style>
a img {
border: 0;
}
ul#img_hover {
list-style: none;
margin: 0 auto; padding: 0;
}
ul#img_hover li {
float: left;
text-align: center;
display: inline;
}
ul#img_hover li a.thumb {
width: 305px;
height: 71px;
cursor: pointer;
}

ul#img_hover li span {
width: 305px;
height: 71px;
overflow: hidden;
display: block;
}

ul#img_hover li a {
text-decoration: none;
display: block;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("ul#img_hover li").hover(function() { //On hover...
var thumbOver = jQuery(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
//Set a background image(thumbOver) on the <a> tag
jQuery(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
//Fade the image to 0
jQuery(this).find("span").stop().fadeTo('normal', 0 , function() {
jQuery(this).hide() //Hide the image after fade
});
} , function() { //on hover out...
//Fade the image to 1
jQuery(this).find("span").stop().fadeTo('normal', 1).show();
});
});

</script>
<ul id="img_hover">
<li>
<a href="http://r-ednalan.blogspot.com/" class="thumb">
<span class="slide1"><img src="images/button.png"/></span>
</a>
</li>
</ul>

Tuesday, September 6, 2011

jquery/Ajax php - loading image once file submit

jquery/Ajax php - loading image once file submit





<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".save").live("click", function () {

$("#loading").fadeIn('slow');
var edit = $(".edit").val();
var id = $("#idrec").val();
var data = '?id=' + id + '&text=' + edit;

$.post("update.php", data, function (response) {
$("#loading").fadeOut('slow');
$("#status").html(data);
});
});
});
</script>
<style>
form {
width: 100%;
}
.save{
margin:0px 0px 0 5px;
}
#loading {
display:none;
}
</style>
<h2>jquery/Ajax php - loading image once file submit = <img id="loading" src="images/loading.gif"/></h2>
Click the text below to edit it. <span id="status"></span>
<form ><input type="hidden" id="idrec" value="2"/></span><textarea class="edit">jquery/Ajax php - loading image once file submit</textarea> </form>
<a href="#" class="save"><img src="images/save.png" border="0" width="48" height="15"/></a>


update.php
<?php
$text = $_POST['text'];
$id = mysql_escape_string($_POST['id']);
echo stripslashes($text);
?>

Wednesday, August 17, 2011

jQuery Ajax PHP Delete Records Confirmation

jQuery Ajax PHP Delete Records Confirmation

Download

http://dl.dropbox.com/u/7106563/r-ednalan/Delete_Records_Confirmation.zip




Jquery Ajax
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>

<script type="text/javascript">
$(function() {
$(".delbutton").click(function(){
var element = $(this);
//Find the id of the link that was clicked
var del_id = element.attr("id");
//Built a url to send
var info = 'id=' + del_id;
if(confirm("Sure you want to delete this update? There is NO undo!"))
{
$.ajax({
type: "GET",
url: "delete.php",
data: info,
success: function(){
}
});
$(this).parents(".record").animate({ backgroundColor: "#fbc7c7" }, "fast")
.animate({ opacity: "hide" }, "slow");
}
return false;
});
});
</script>

CSS Code
<style>

#rounded-corner
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: 12px;
margin: 45px;
width: 480px;
text-align: left;
border-collapse: collapse;
}
#rounded-corner thead th.rounded-company
{
background: #b9c9fe url('table-images/left.png') left -1px no-repeat;
}
#rounded-corner thead th.rounded-q4
{
background: #b9c9fe url('table-images/right.png') right -1px no-repeat;
}
#rounded-corner th
{
padding: 8px;
font-weight: normal;
font-size: 13px;
color: #039;
background: #b9c9fe;
}
#rounded-corner td
{
padding: 8px;
background: #e8edff;
border-top: 1px solid #fff;
color: #669;
}
#rounded-corner tfoot td.rounded-foot-left
{
background: #e8edff url('table-images/botleft.png') left bottom no-repeat;
}
#rounded-corner tfoot td.rounded-foot-right
{
background: #e8edff url('table-images/botright.png') right bottom no-repeat;
}
#rounded-corner tbody tr:hover td
{
background: #d0dafd;
}
</style>

index.php
<table id="rounded-corner" border="0">

<thead>
<tr>
<th scope="col" class="rounded-company">Company</th>
<th scope="col" class="rounded-q1">Q1</th>
<th scope="col" class="rounded-q2">Q2</th>
<th scope="col" class="rounded-q3">Q3</th>
<th scope="col" class="rounded-q3">Q4</th>
<th scope="col" class="rounded-q4" width="15px;"></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5" class="rounded-foot-left"><em></em></td>
<td class="rounded-foot-right"> </td>
</tr>
</tfoot>
<tbody>
<?php

include("dbconfig.php");
$query4="select * from table order by id desc";
$result4 = mysql_query($query4);
while($row=mysql_fetch_array($result4))
{
$message=stripslashes($row["company"]);
?>
<tr class="record">
<td><?php echo $message; ?></td>
<td>20.3</td>
<td>30.5</td>
<td>23.5</td>
<td>40.3</td>
<td><a href="#" id="<?php echo $row["id"]; ?>" class="delbutton"><img src="publish_x.png"/></a></td>
</tr>
<?php
}
?>
</tbody>
</table>

delete.php
<?php

include("dbconfig.php");
if($_GET['id'])
{
$id=$_GET['id'];
$sql = "delete from messages where id='$id'";
mysql_query( $sql);
}
?>

dbconfig.php
<?php

$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "ednalan";
$mysql_database = "test";

$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
?>

Monday, August 15, 2011

Create a Sliding tab contents tab jquery

Create a Sliding tab contents tab jquery

Demo

http://dl.dropbox.com/u/7106563/r-ednalan/Slidingf_tab.html








   <style>

*{
margin:0px;
padding:0px;
}
body{
color:#444444;
font-size:13px;
background: #f2f2f2;
font-family:"Century Gothic", Helvetica, sans-serif;
}
#content{
text-align:center;
height:100%;
margin-left:20px;
margin-top:20px;
}
#wrapper{
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
border:2px solid #fff;
background-color:#FFFFFF;
width:520px;
overflow:hidden;
}
#slides{
width:600px;
/*height:320px;*/
overflow:hidden;
}
.slides_contents{
float:left;
width:600px;
/*height:320px;*/
}
#navigation{
height:45px;
background-color:#EBEBEB;
border-top:1px solid #fff;
-moz-border-radius:0px 0px 5px 5px;
-webkit-border-bottom-left-radius:5px;
-webkit-border-bottom-right-radius:5px;
border-bottom-left-radius:5px;
border-bottom-right-radius:5px;
}
#navigation ul{
list-style:none;
float:left;
margin-left:22px;
}
#navigation ul li{
float:left;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
position:relative;
margin:0px 2px;
}
#navigation ul li a{
display:block;
height:45px;
background-color:#444;
color:#777;
outline:none;
font-weight:bold;
text-decoration:none;
line-height:45px;
padding:0px 20px;
border-right:1px solid #fff;
border-left:1px solid #fff;
background:#FBFBFB;
background:
-webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.09, rgb(240,240,240)),
color-stop(0.55, rgb(227,227,227)),
color-stop(0.78, rgb(240,240,240))
);
background:
-moz-linear-gradient(
center bottom,
rgb(240,240,240) 9%,
rgb(227,227,227) 55%,
rgb(240,240,240) 78%
)
}
#navigation ul li a:hover,
#navigation ul li.selected a{
background:#d8d8d8;
color:#666;
text-shadow:1px 1px 1px #fff;
}
#slides form fieldset{
border:none;
padding-bottom:20px;
}
#slides form legend{
text-align:left;
background-color:#EBEBEB;
color:#2D3B40;
font-size:24px;
text-shadow:1px 1px 1px #fff;
font-weight:bold;
float:left;
width:100%;
padding:5px 0px 5px 10px;
margin:10px 0px;
border-bottom:1px solid #949494;
border-top:1px solid #828282;
}
#slides form p{
float:left;
clear:both;
margin:5px 0px;
border:0px solid #fff;
width:100%;
}
#slides form p label{
width:160px;
float:left;
text-align:right;
margin-right:15px;
line-height:26px;
color:#666;
text-shadow:1px 1px 1px #fff;
font-weight:bold;
}
#slides form input{
background: #ffffff;
border: 1px solid #ddd;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
outline: none;
padding: 5px;
width: 200px;
float:left;
}
#slides form input:focus{
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
background-color:#FFFEEF;
}
#slides form button {
border:none;
outline:none;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
color: #ffffff;
display: block;
cursor:pointer;
margin: 0px auto;
clear:both;
padding: 5px 20px;
text-shadow: 0 1px 1px #777;
font-weight:bold;
font-family:"Century Gothic", Helvetica, sans-serif;
font-size:18px;
-moz-box-shadow:0px 0px 3px #aaa;
-webkit-box-shadow:0px 0px 3px #aaa;
box-shadow:0px 0px 3px #aaa;
background:#969B9F;
}
#slides form button:hover {
background:#7F9DB9;
color:#666;
text-shadow:1px 1px 1px #fff;
}
#slides form .submitbutton {
width:650px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var fieldsetCount = $('#formElem').children().length; //number of fieldsets
var current = 1; //current position of fieldset
var slidesWidth = 0; //widths of each one of the fieldsets
var widths = new Array();
$('#slides .slides_contents').each(function(i){
var $slides_contents = $(this);
widths[i] = slidesWidth;
slidesWidth += $slides_contents.width();
});
$('#slides').width(slidesWidth);
$('#formElem').children(':first').find(':input:first').focus(); //to avoid problems in IE, focus the first input of the form
$('#navigation a').bind('click',function(e){
var $this = $(this);
var prev = current;
$this.closest('ul').find('li').removeClass('selected');
$this.parent().addClass('selected');
current = $this.parent().index() + 1;
$('#slides').stop().animate({
marginLeft: '-' + widths[current-1] + 'px'
});
e.preventDefault();
});
});
</script>
<div id="content">
<div id="wrapper">
<div id="slides">
<form id="formElem" name="formElem" action="" method="post">
<fieldset class="slides_contents">
<legend>Account</legend>
<p>
<label for="username">User name</label>
<input id="username" name="username" />
</p>
<p>
<label for="name">Name</label>
<input id="name" name="name" />
</p>
<p>
<label for="email">Email</label>
<input id="email" name="email" placeholder="ednalan@yahoo.com" type="email" AUTOCOMPLETE=OFF />
</p>
<p>
<label for="password">Password</label>
<input id="password" name="password" type="password" AUTOCOMPLETE=OFF />
</p>
<p class="submitbutton">
<button type="submit">Submit</button>
</p>
</fieldset>
<fieldset class="slides_contents">
<legend>Profile</legend>
<div style="text-align:left;width:500px;margin:10px 10px 10px 10px;">
Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum ipsum.
Proin imperdiet est. Phasellus dapibus semper urna. Pellentesque ornare, <br/><br/>
Proin imperdiet est. Phasellus dapibus semper urna. Pellentesque ornare, <br/><br/>
Proin imperdiet est. Phasellus dapibus semper urna. Pellentesque ornare, <br/><br/>
orci in felis. Donec ut ante. In id eros. Suspendisse lacus turpis, cursus egestas at sem.
</div>
</fieldset>
</form>
</div>
<div id="navigation" >
<ul>
<li class="selected">
<a href="#">Account</a>
</li>
<li>
<a href="#">Profile</a>
</li>
</ul>
</div>
</div>
</div>

Saturday, August 13, 2011

Sample JavaScript Onload Functions Sample using google map code

Sample JavaScript Onload Functions Sample using google map code







<html>

<head>
<title>Google Maps API Sample</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAuPsJpk3MBtDpJ4G8cqBnjRRaGTYH6UMl8mADNa0YKuWNNa8VNxQCzVBXTx2DYyXGsTOxpWhvIG7Djw" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
window.onload=initialize; //JavaScript Onload Functions
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
var address = '1600 Amphitheatre Pky, Mountain View, CA';
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
</script>
</head>
<body>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>
</html>

Saturday, August 6, 2011

Placeholder Text using HTML5

Placeholder Text using HTML5

Placeholder attribute allows you to display text in a form input when it is empty and when it is not focused




<style>
body {
font: 90%/150% Arial, Helvetica, sans-serif;
color: #666;
width: 700px;
margin: 30px auto;
}
a {
color: #000;
text-decoration: none;
}
a:hover {
color: #F60;
}
p {
margin: 0 0 2em;
}
h1, h2, h3 {
line-height: 110%;
}
h1 {
font: bold 80% Arial, Helvetica, sans-serif;
text-transform: uppercase;
margin: 0 0 2px;
color: #999;
}
h2 {
margin: 0 0 8px;
}
h3 {
border-top: solid 2px #ccc;
margin: 40px 0 15px;
padding-top: 10px;
}
form p {
margin: 0 0 15px;
}
input,
textarea,
input[type=search] {
background: #f4f4f4;
border: solid 1px #a3a3a3;
padding: 5px 10px;
font: 15px "Times New Roman", Times, serif;
-webkit-box-shadow: inset 0 2px 3px rgba(0,0,0,.1);
-moz-box-shadow: inset 0 2px 3px rgba(0,0,0,.1);
box-shadow: inset 0 2px 3px rgba(0,0,0,.1);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-appearance: none; /* reset webkit search style */
}
/* input:focus */
input[type=text]:focus,
textarea:focus,
input[type=search]:focus {
background: #fff;
border-color: #333;
outline: none; /* remove outline */
}
/* field width */
input[type=text], input[type="search"] {
width: 200px;
}
textarea {
width: 400px;
height: 250px;
}
/* placeholder */
.placeholder {
color: #bbb;
}
/* webkit placeholder */
::-webkit-input-placeholder {
color: #bbb;
}
/* moz placeholder */
:-moz-placeholder {
color: #bbb;
}
</style>

</head>

<form class="form" method="post">
<p><input type="text" placeholder="Your name please"></p>
<p><input type="text" placeholder="Enter your email"></p>
<p><textarea placeholder="Write your comments here"></textarea></p>
<p><input type="submit" name="submit" value="Submit"></p>
</form>

Related Post