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>

Monday, July 25, 2011

Simple jquery Demonstration show hide Toggle slide fade

Simple jquery Demonstration show hide Toggle slide fade












<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script type="text/javascript">
function showSlidingDiv(){
$("#slidingDiv").animate({"height": "toggle"}, { duration: 1000 });
}

$(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
$('#slickbox').hide();
// shows the slickbox on clicking the noted link
$('#slick-show').click(function() {
$('#slickbox').show('slow');
return false;
});
// hides the slickbox on clicking the noted link
$('#slick-hide').click(function() {
$('#slickbox').hide('fast');
return false;
});

// toggles the slickbox on clicking the noted link
$('#slick-toggle').click(function() {
$('#slickbox').toggle(400);
return false;
});

$('#slick-down').click(function() {
$('#slickbox').slideDown('slow');
return false;
});
$('#slick-up').click(function() {
$('#slickbox').slideUp('slow');
return false;
});
$('#slick-slidetoggle').click(function() {
$('#slickbox').slideToggle('slow');
return false;
});
$('#slick-fadeIn').click(function() {
$('#slickbox').fadeIn('slow');
return false;
});
$('#slick-fadeOut').click(function() {
$('#slickbox').fadeOut('slow');
return false;
});
});
</script>
<style>
#slidingDiv {
display: none;
height:300px;
background-color: #99CCFF;
padding:20px;
width:20%;
}
#slickbox {
display: none;
height:100px;
background-color: #99CCFF;
padding:20px;
width:20%;
}
</style>
<a href="#" onClick="showSlidingDiv(); return false;">Show/hide - Sliding Div</a><br />
<div id="slidingDiv">
Fill this space with really interesting content that you can <a href="#" onClick="showSlidingDiv(); return false;">hide</a>
</div>

<p>
<a href="#" id="slick-show">Show the box</a>
<a href="#" id="slick-hide">Hide the box</a>
<a href="#" id="slick-toggle">Toggle the box</a>
</p>
<div id="slickbox">This is the box that will be shown and hidden and toggled at your whim. :)</div>

<p>
<a href="#" id="slick-down">Slide the box down</a>
<a href="#" id="slick-up">Slide the box up</a>
<a href="#" id="slick-slidetoggle">Slide toggle the box</a>
</p>
<p>
<a href="#" id="slick-fadeIn">Fade In</a>
<a href="#" id="slick-fadeOut">Fade Out</a>
</p>


Demo

http://dl.dropbox.com/u/7106563/r-ednalan/jquery-show-hide.html

Thursday, July 21, 2011

Create a modal box jquery ajax php mysql

Create a modal box jquery ajax php mysql

This is a code tutorial how to create a modal box using jquery and jquery ajax and php mysql login form













Javascript code
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script>
$(document).ready(function() {
//select all the a tag with name equal to modal
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
//Get the A tag
var id = $(this).attr('href');
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/3-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(2000);
});

//if close button is clicked
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
//if mask is clicked
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});

//jquery ajax
$("#login_form").submit(function() {
var unameval = $("#username").val();
var pwordval = $("#password").val();
$("#flash").show();
$("#flash").fadeIn("slow",0.25).html('<img src="ajax-loading.gif" align="absmiddle"> <span class="loading">Loading...</span>');
$.post("login.php", { username: unameval,
password: pwordval }, function(data) {
$("#status").html(data);
});
$("#flash").hide();
return false;
});

});

</script>

CSS Code
<style>
#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#969393;
display:none;
}
.window {
position:absolute;
left:0;
top:0;
width:440px;
height:200px;
display:none;
z-index:9999;
padding:20px;
}
.note-box {
width:300px;
height:260px;
color:#818181;
background: #FFFFFF;
border: 2px solid #ccc;
padding:10px;
font-family: Georgia;
font-size: 14px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
}
h1{font-weight:normal;font-size:20px;color:#aaaaaa;margin:0 0 4px 0;}
p{font-size: 20px;color: #000000;}
a {color:#729e01;text-decoration:none;}
a:hover{color:#dedede;}
input.text{ border:#ccc 1px solid;-moz-border-radius:7px; -webkit-border-radius:7px;font-size: 20px;width:300px;padding-left:5px;}
.highlight-1, .highlight-2, .highlight-3 { font-size: 14px;color: #000000; -moz-border-radius : 4px; -webkit-border-radius : 4px; padding : 5px 10px;}
.highlight-1 { background : #fce9e9;border : 1px #eac7c7 solid; }
.highlight-2 {background : #fcfae9;border : 1px #e9e6c7 solid; }
.highlight-3 {background : #edfce9;border : 1px #cceac4 solid;}
.ptour_crtbtn{border:1px outset #ccc;padding:5px 2px 4px;color:#fff;min-width: 100px;text-align: center;cursor:pointer;background:#729e01;background:-webkit-gradient(linear, left top, left bottom,from(#a3d030),to(#729e01));background:-moz-linear-gradient(top,#a3d030,#729e01);background:-o-linear-gradient(top,#a3d030,#729e01);background:linear-gradient(top,#a3d030,#729e01);-moz-border-radius:7px; -webkit-border-radius:7px;
}
.fail {
background-color: #FFECE6;
border: 1px solid #FF936F;
color: #842100;
background-image: url(delete00.png);
background-repeat: no-repeat;
padding:5px;
padding-left:30px;
}
</style>

HTML Code
<div style="text-align:center"><a href="#modalboxlogin" name="modal"><h1>Click here to open modal login form</h1></a></div>
<div id="modalboxlogin" class="window note-box">
<div id="flash" align="left" ></div>
<div id="status"></div>
<form id="login_form" action="" method="POST">
<p><label style="display: block;">Email:</label><input class="text" type="text" id="username" name="username" /></p>
<p><label style="display: block;">Password:</label><input class="text" type="password" id="password" name="password" /></p>
<p style="text-align:right"><button class="ptour_crtbtn" name="login" type="submit">Login</button></p>
</form>
<p style="text-align:right"><a href="#" class="close"><img src="closelabel.gif"/></a></p>
</div>
<!-- Mask to cover the whole screen -->
<div id="mask"></div>


login.php code
<?php
$mysql_host = 'localhost';
$mysql_username = 'root';
$mysql_password = 'ednalan';
#connect to the database
mysql_connect("$mysql_host","$mysql_username","$mysql_password");
mysql_select_db("dbednalan");
#A function to secure SQL queries in the script.
function sql_secure($string) {
if (get_magic_quotes_gpc()) {
$string = stripslashes($string);
}
$string = mysql_real_escape_string($string);
return $string;
}
$username = sql_secure($_POST['username']);
$password = sql_secure($_POST['password']);
#check details are of required lenght.
if (strlen($password) <= 3 || strlen($username) <= 3)
{
//echo "Username or Password Must Be Over 3 Characters";
}
$sql = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
$query = mysql_query($sql);
$num_rows = mysql_num_rows($query);
#if user exists set some cookies.
if ($num_rows == '1'){
page_redirect("http://r-ednalan.blogspot.com/");
}else {
echo "<div class=\"fail\">Login failed, Please try again</div>";
}

?>


Download

http://dl.dropbox.com/u/7106563/r-ednalan/modalboxlogin_jquery-php-mysql.zip

Tuesday, July 19, 2011

Create a jquery tab

Create a jquery tab
A tutorial how to create a tab manipulated using jQuery







The Code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#tabs div').hide();
$('#tabs div:first').show();
$('#tabs ul li:first').addClass('active');
$('#tabs ul li a').click(function(){
$('#tabs ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).show();
return false;
});
});
</script>
<style type="text/css">

.solidblockmenu{
margin: 0;
padding: 0;
float: left;
font: bold 13px Arial;
width: 100%;
overflow: hidden;
margin-bottom: 1em;
border: 1px solid #625e00;
border-width: 1px 0;
background: black url(images/blockdefault.gif) center center repeat-x;
}
.solidblockmenu li{
display: inline;
}
.solidblockmenu li a{
float: left;
color: white;
padding: 9px 11px;
text-decoration: none;
border-right: 1px solid white;
}
.solidblockmenu li a:visited{
color: white;
}
#tabs ul li.active a {
color: white;
background: transparent url(images/blockactive.gif) center center repeat-x;
}
#container {
width:40%;
background: #494949;
color:#FFFFFF;
}
#container p{
padding:15px;
}
#container h3{
padding:15px;
}
</style>
<div id="container">
<div id="tabs">
<ul class="solidblockmenu">
<li><a href="#tab-1">This is Tab 1</a></li>
<li><a href="#tab-2">Tab Two</a></li>
<li><a href="#tab-3">Tab Three</a></li>
<li><a href="#tab-4">Tab Four</a></li>
</ul>

<div id="tab-1">
<h3>This is a really simple tabbed interface</h3>
<p>Lorem ipsum dolor vitae quam. Vivamus ut odio.
Pellentesque mollis arcu nec metus. Nullam bibendum scelerisque turpis. Aliquam erat volutpat. <br/>
</p>
</div>
<div id="tab-2">
<h3>Tab 2</h3>
<p>Lorem ipsum dolor vitae quam. Vivamus ut odio.
Pellentesque mollis arcu nec metus. Nullam bibendum scelerisque turpis. Aliquam erat volutpat. <br/>
</p>
</div>
<div id="tab-3">
<h3>Tab 3</h3>
<p>Lorem ipsum dolor vitae quam. Vivamus ut odio.
Pellentesque mollis arcu nec metus. Nullam bibendum scelerisque turpis. Aliquam erat volutpat. <br/>
</p>
</div>
<div id="tab-4">
<h3>Tab 4</h3>
<p>Lorem ipsum dolor vitae quam. Vivamus ut odio.
Pellentesque mollis arcu nec metus. Nullam bibendum scelerisque turpis. Aliquam erat volutpat. <br/>
</p>
</div>

</div>
</div>


Download

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

Monday, July 18, 2011

Create a Confirmation Message Effect Delay Message like twitter

Create a Confirmation Message Effect Delay Message like twitter





//index.html
<style>
body {
font: normal 85% arial,verdana,tahoma,sans-serif;
color: #000;
margin: 10;
padding: 10;
background: #d3f3f5;
}
#errorMessage, #confirmationMessage {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 70px;
font: normal 1.4em arial;
line-height: 70px;
text-align: center;
color: #000;
background: #fff;
border-bottom: 1px solid #ddd;
filter:alpha(opacity=92);
-moz-opacity: 0.92;
opacity: 0.92;
display: none; /* LEAVE THIS IN*/
}
fieldset {
width: 490px;
margin: 0;
padding: 20px;
background: #f4f4f4;
border: 1px solid #ddd;
}
label {
display: block;
font: bold 1.0em arial,verdana,tahoma,sans-serif;
color: #000;
margin: 0 20px 10px 0;
padding: 0;
clear: left;
}
.textfield, .textarea {
width: 200px;
font: normal 1.0em arial,verdana,tahoma,sans-serif;
color: #000;
margin: 0 0 20px 0;
padding: 5px 6px;
background: #fff;
border: 1px solid #ddd;
}
.textarea {
width: 470px;
height: 110px;
}
.textfield:focus, .textarea:focus {
border: 1px solid #ccc;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function()
{
$(".jquerySubmit").click(function(){
$('#confirmationMessage').delay(400).slideDown(400).delay(3000).slideUp(400);
});
});
</script>
<div id="confirmationMessage">
Thank you. Your message has been sent
</div>

<form method="post" action="">
<fieldset>
<label>Name:</label>
<input type="text" name="Name" class="textfield" />
<label>Comments:</label>
<textarea name="Comments" class="textarea"></textarea>
<a href="#" class="jquerySubmit">SUBMIT </a>
</fieldset>
</form>


Demo

http://dl.dropbox.com/u/7106563/r-ednalan/create-effect-delay-message-like.html

Create a jquery slideToggle

Create a jquery slideToggle









<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip").click(function(){
$(".panel").slideToggle("slow"); //The speed parameter can take the following values: "slow", "fast", "normal", or milliseconds.
});
});
</script>
<style type="text/css">
div.panel,p.flip
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
width:30%;
}
div.panel
{
height:120px;
display:none;
width:30%;
}
</style>

<div class="panel">
<p>lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel,</p>
<p>Sed lacus. Donec lectus. Nullam pretium nibh ut Donec ipsum</p>
</div>
<p class="flip">Show/Hide Panel</p>

Wednesday, July 13, 2011

Create Javascript Popup page

Create Javascript Popup page




<script language="JavaScript" type="text/JavaScript">
function popup(url,w,h,name,resizable,toolbar,left,top)
{
var features ="location=no,menubars=no,"+"width=550," +"height=550,"+"resizable=yes," +"scrollbars=yes," + "status=yes," + "titlebar=no," +"toolbar="+toolbar+"," +"left="+left+"," +"top="+top;
var win = window.open(url,name,features);
}
</script>
<div>
By clicking Next, you are indicating that you have read and agree to the
<a href="javascript:popup('popuppage.html')" title="Privacy Policy" rel="bookmark">Privacy Policy</a>
</div>

Create a Javascript show hide contents

Create a Javascript show hide contents











//css
<style>
.bigbold {
font-weight: bold;
font-size: 25px;
}
.heading
{
background-color: #8FAFBF;
text-align: center;
font-weight: bold;
height: 30px;
}
</style>

//javascript  
<script>
function showhideit(id,hid)
{
curstatus = document.getElementById(id).style.display;
if(curstatus == "none")
{
document.getElementById(id).style.display = 'inline';
document.getElementById(hid + '1').innerHTML = ' -';
document.getElementById(hid + '2').innerHTML = '- ';
}
else
{
document.getElementById(id).style.display = 'none';
document.getElementById(hid + '1').innerHTML = ' +';
document.getElementById(hid + '2').innerHTML = '+ ';
}
}
</script>

//HTML
<table align="center" cellpadding="0" cellspacing="0" border="1">
<tr class="heading" style="cursor: pointer;" onclick="showhideit('information','info')">
<td width="100" align="left" class="bigbold" id="info1"> +</td>
<td align="center"><b>CLICK TO SHOW INFORMATION</b></td>
<td width="100" align="right" class="bigbold" id="info2">+ </td>
</tr>
<tr>
<td colspan="3" width="100">
<div style="display:none;" id="information">
PHP Loops
Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task like this.
In PHP, we have the following looping statements:
while - loops through a block of code while a specified condition is true
do...while - loops through a block of code once, and then repeats the loop as long as a specified condition is true
for - loops through a block of code a specified number of times
foreach - loops through a block of code for each element in an array
</div>
</td>
</tr>
</table>


Demo

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

Javascript show hide toggle

Javascript show hide toggle



<script type="text/javascript">
function toggle(obj){
var el = document.getElementById(obj);
if (el.style.display != 'none') {
el.style.display = 'none';
}
else {
el.style.display = 'inline';
}
}
</script>
<a href="#test1" onclick="toggle('table1');">Toggle 01 </a><br />
<table id="table1" style="display:none;" border="1" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCCC">
<td width="100" align="center"><font>PROGRAMME</font></td>
<td width="150" align="center"><font>OBJECTIVES</font></td>
<td width="210" align="center"><font>MODULES</font></td>
</tr>
</table>
<br/>
<a href="#test2" onclick="toggle('table2');">Toggle 02</a><br />
<table id="table2" style="display:none;" border="1" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCCC">
<td width="100" align="center"><font>PROGRAMME</font></td>
<td width="150" align="center"><font>OBJECTIVES</font></td>
<td width="210" align="center"><font>MODULES</font></td>
</tr>
</table>

Demo

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

Javascript One Function to Count and Limit Multiple Form Text Areas

Javascript One Function to Count and Limit Multiple Form Text Areas




Javascript
<SCRIPT LANGUAGE="JavaScript">
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
// End -->
</script>

HTML Form
<form name="myForm"
action=""
method="post">
<b>One Function to Count and Limit Multiple Form Text Areas</b><br>

<textarea name="message1" wrap="physical" cols="28" rows="5"
onKeyDown="textCounter(document.myForm.message1,document.myForm.remLen1,125)"
onKeyUp="textCounter(document.myForm.message1,document.myForm.remLen1,125)"></textarea>

<br>
<input readonly type="text" name="remLen1" size="3" maxlength="3" value="125">
characters left
<br>
<textarea name="message2" wrap="physical" cols="28" rows="5"
onKeyDown="textCounter(document.myForm.message2,document.myForm.remLen2,125)"
onKeyUp="textCounter(document.myForm.message2,document.myForm.remLen2,125)"></textarea>
<br>
<input readonly type="text" name="remLen2" size="3" maxlength="3" value="125">
characters left
<br>
<input type="Submit" name="Submit" value="Submit">
<br>
</form>

Friday, July 1, 2011

Create a bubble tooltip using javascript

Create a bubble tooltip using javascript

This demo demonstrates how the balloon tooltip works. Roll your mouse over the links.





CSS Code
<style>
a{
color: #D60808;
text-decoration:none;
}
a:hover{
border-bottom:1px dotted #317082;
color: #307082;
}
#bubble_tooltip{
width:147px;
position:absolute;
display:none;
}
#bubble_tooltip .bubble_top{
background-image: url('images/bubble_top.gif');
background-repeat:no-repeat;
height:16px;
}
#bubble_tooltip .bubble_middle{
background-image: url('images/bubble_middle.gif');
background-repeat:repeat-y;
background-position:bottom left;
padding-left:7px;
padding-right:7px;
}
#bubble_tooltip .bubble_middle span{
position:relative;
top:-8px;
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
font-size:11px;
}
#bubble_tooltip .bubble_bottom{
background-image: url('images/bubble_bottom.gif');
background-repeat:no-repeat;
background-repeat:no-repeat;
height:44px;
position:relative;
top:-6px;
}
</style>

Javascript code
<script>
function showToolTip(e,text){
if(document.all)e = event;
var obj = document.getElementById('bubble_tooltip');
var obj2 = document.getElementById('bubble_tooltip_content');
obj2.innerHTML = text;
obj.style.display = 'block';
var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
var leftPos = e.clientX - 100;
if(leftPos<0)leftPos = 0;
obj.style.left = leftPos + 'px';
obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
}

function hideToolTip()
{
document.getElementById('bubble_tooltip').style.display = 'none';

}
</script>

HTML Code
<div id="bubble_tooltip">
<div class="bubble_top"><span></span></div>
<div class="bubble_middle"><span id="bubble_tooltip_content"></span></div>
<div class="bubble_bottom"></div>
</div>
<a href="#" onmouseover="showToolTip(event,'This is the content of the tooltip. This is the content of the tooltip.');return false" onmouseout="hideToolTip()"><h2>Roll over me</h2></a> </p>



Demo


http://dl.dropbox.com/u/3293191/r-ednalan/bubble_tooltip/index.html

Download
http://dl.dropbox.com/u/3293191/r-ednalan/bubble_tooltip/bubble_tooltip.zip

Related Post