Email validation in javascript without using regular expression


"THARIKIDA"

<html>
<head>
<title>Email Validation</title>
<script type=”text/javascript”>
function validate()
{
var str;
var t=1;
str =document.getElementById(’email’).value;
if(document.getElementById(’email’).value==””)
{
alert(“Empty”);

}
var res = str.split(‘@’);
if(str.split(‘@’).length!=2)
{
alert(“zero @ OR morethan one @ “);
t=0;
}
var part1=res[0];
var part2=res[1];

// part1
if(part1.length==0)
{
alert(“no content bfr @”);
t=0;
}
if(part1.split(” “).length>2)
{
alert(“Invalid:Space before @”)
t=0;
}

//chk afr @ content:  part2
var dotsplt=part2.split(‘.’);  //alert(“After @ :”+part2);
if(part2.split(“.”).length<2)
{
alert(“dot missing”);
t=0;
}
if(dotsplt[0].length==0 )
{
alert(“no content b/w @ and dot”);
t=0;
}
if(dotsplt[1].length<2 ||dotsplt[1].length>4)
{alert(“err aftr dot”);
t=0;
}

if(t==1)
alert(“woooooooooooooooooooowwwww…it is a valid email”);

}

</script>
</head>

<body>
<label>
<input type=”text” name=”email” id=”email”  />
<input type=”button” name=”btnok” onclick=”validate()” />
</label>
</body>
</html>

View original post

Simple jQuery Accordion


Gopal Sikdar

jQuery

Make sure either to run on DOM ready or at the bottom of the page.

(function($) {

var allPanels = $(‘.accordion > p’).hide();

$(‘.accordion > h1 > a’).click(function() { allPanels.slideUp();

$(this).parent().next().slideDown(); return false; });

})

(jQuery);

HTML

<div class=”accordion”>

<h1><a href=””>Panel 1</a></h1>

<p>Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.</p>

<h1><a href=””>Panel 2</a></h1>

<p>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</p>

<h1><a href=””>Panel 3</a></h1>

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</p>

</div>

CSS

.accordion { margin: 50px;

h1, p { padding: 10px; border: 1px solid black; border-bottom: 0;

&:last-of-type { border-bottom: 1px solid black; }

View original post 29 more words

How to add excerpt on a Page in WordPress without plugin


To add an excerpt field in WordPress Pages like we have in Posts, just paste the following code to your functions.php and have fun !!

add_post_type_support( 'page', 'excerpt' );