<div id="test">
<div id="test_1" style="display:none">
Hello World!
</div>
</div>
jQuery code:
if ($('#test_1:visible').length > 0)
{
alert('the element is visible');
}
else
{
alert('the element is not visible');
}
Tuesday, 24 July 2012
how to check element visibility in jquery?
example of element exists and it’s not visible
Tuesday, 3 July 2012
how to replace & or special characters in javascript?
//if value of catnm='art & jewllery';
//then i want need to replace "&".
//because when i will try to post data using jquery then jquery know this is query string.....so i want to need to replace "&" using "URL ENCODED CHARACTERS"
//so,see below example
var catnm=document.getElementById('catnm').value;
var cat_re=catnm.replace('&','%26');
OUTPUT
In Javascript alert box : art %26 jewllery
In html format(in web browser ) : art & jewllery
Please refer below website for URL Encode Characters
http://www.degraeve.com/reference/urlencoding.php
http://www.w3schools.com/tags/ref_urlencode.asp
//then i want need to replace "&".
//because when i will try to post data using jquery then jquery know this is query string.....so i want to need to replace "&" using "URL ENCODED CHARACTERS"
//so,see below example
var catnm=document.getElementById('catnm').value;
var cat_re=catnm.replace('&','%26');
OUTPUT
In Javascript alert box : art %26 jewllery
In html format(in web browser ) : art & jewllery
Please refer below website for URL Encode Characters
http://www.degraeve.com/reference/urlencoding.php
http://www.w3schools.com/tags/ref_urlencode.asp
Friday, 27 April 2012
how to validate multiple select box with jquery?
$("#form").validate({
rules:{
"select_esp[]": "required"
},
messages:{
"select_esp[]": "Select this"
}
});
rules:{
"select_esp[]": "required"
},
messages:{
"select_esp[]": "Select this"
}
});
Saturday, 14 April 2012
How to enable/disable element in Javascript
If u want to enable or disable any HTML element using javascript in asp.net/php u can use the following code,
document.getelementbyid('nm').disabled='disabled' ;
and the below code will enable the element,
document.getelementbyid('nm').disabled='';
document.getelementbyid('nm').disabled='disabled' ;
and the below code will enable the element,
document.getelementbyid('nm').disabled='';
Thursday, 5 April 2012
Tuesday, 3 April 2012
how to make captcha in php?
Captcha Code:
<?php
session_start();
$num='';
$string = "abcdefghijklmnopqrstuvwxyz0123456789";
for($i=0;$i<7;$i++){
$num1=rand(0,35);
$num .= $string{$num1};
}
$_SESSION["num1"]=$num;
$img=imagecreatefrompng('captcha.png');
$color=imagecolorallocate($img,255,255,255);
$color1=imagecolorallocate($img,0,0,0);
imagestring($img,9,10,3,$num,30);
$fontsize=20;
$fontcolor = imagecolorallocate($img, 0, 0, 0);
$x = 0;
$y = $fontsize;
header('Content-type : image/png');
imagepng($img);
imagedestroy($img);
?>
How to use in php?
<img id="cap" style="margin-left: 15px;" src="comman/captcha.php" alt="" />
How to refresh captcha?
Call the below function onclick
<script >
function captcha()
{
document.getElementById('cap').src = document.getElementById('cap').src+ '?';
}
</script>
Save as captcha.png file
<?php
session_start();
$num='';
$string = "abcdefghijklmnopqrstuvwxyz0123456789";
for($i=0;$i<7;$i++){
$num1=rand(0,35);
$num .= $string{$num1};
}
$_SESSION["num1"]=$num;
$img=imagecreatefrompng('captcha.png');
$color=imagecolorallocate($img,255,255,255);
$color1=imagecolorallocate($img,0,0,0);
imagestring($img,9,10,3,$num,30);
$fontsize=20;
$fontcolor = imagecolorallocate($img, 0, 0, 0);
$x = 0;
$y = $fontsize;
header('Content-type : image/png');
imagepng($img);
imagedestroy($img);
?>
How to use in php?
<img id="cap" style="margin-left: 15px;" src="comman/captcha.php" alt="" />
How to refresh captcha?
Call the below function onclick
<script >
function captcha()
{
document.getElementById('cap').src = document.getElementById('cap').src+ '?';
}
</script>
Save as captcha.png file
Monday, 2 April 2012
how to check path of ffmpeg or mencoder in linux in php?
<?php
$output = shell_exec('whereis ffmpeg');
echo "<pre>".$output."</pre>";
echo "";
$output = shell_exec('whereis mencoder');
echo "<pre>".$output."</pre>";
echo "";
?>
Output in browser :
$output = shell_exec('whereis ffmpeg');
echo "<pre>".$output."</pre>";
echo "";
$output = shell_exec('whereis mencoder');
echo "<pre>".$output."</pre>";
echo "";
?>
Output in browser :
Subscribe to:
Posts (Atom)
