how to call child window(in iframe) function from parent window?
how to call parent window function from child window(in iframe)....
Simple.
From parent window.... framename.child_function_name()
From child window... parent.parent_function_name()
Demo
Download
Cheers!
Friday, June 27, 2008
Div over flash problem in HTML
Some may have this problem.
Always the flash object looks like placed in front of all the objects. So if we want to put a div in front of flash/ over flash we cant.
But there s a solution...
The normal flash object....
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="519" height="255">
<param name="movie" value="center_flash.swf">
<param name="quality" value="High">
<embed src="center_flash.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="519" height="255" quality="High">
</object>
To make it back of all elemnts add
<param name="wmode" value="transparent">
So the actual code we want is...
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="519" height="255">
<param name="movie" value="center_flash.swf">
<param name="quality" value="High">
<param name="wmode" value="transparent">
<embed src="center_flash.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="519" height="255" quality="High">
</object>
Demo
Download
Cheers!
Always the flash object looks like placed in front of all the objects. So if we want to put a div in front of flash/ over flash we cant.
But there s a solution...
The normal flash object....
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="519" height="255">
<param name="movie" value="center_flash.swf">
<param name="quality" value="High">
<embed src="center_flash.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="519" height="255" quality="High">
</object>
To make it back of all elemnts add
<param name="wmode" value="transparent">
So the actual code we want is...
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="519" height="255">
<param name="movie" value="center_flash.swf">
<param name="quality" value="High">
<param name="wmode" value="transparent">
<embed src="center_flash.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="519" height="255" quality="High">
</object>
Demo
Download
Cheers!
Wednesday, June 18, 2008
Radio button validation in Javascript (HTML)
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Check Test</title>
<script language="javascript">
function valBox()
{
var x = document.chkForm;
var i, flg = 0;
for( i=0; i<x.grp.length; i++ )
{
if(x.grp[i].checked)
flg=1;
}
if(!flg)
{
alert("Select One");
return false;
}
}
</script>
</head>
<body>
<form name="chkForm" method="POST" action="#" onsubmit="return valBox();">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table1">
<tr>
<td><input type="radio" value="V1" name="grp">1</td>
</tr>
<tr>
<td><input type="radio" value="V2" name="grp">2</td>
</tr>
<tr>
<td><input type="radio" value="V3" name="grp">3</td>
</tr>
<tr>
<td><input type="submit" value="Submit" name="B1"></td>
</tr>
</table>
</div>
</form>
</body>
</html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Check Test</title>
<script language="javascript">
function valBox()
{
var x = document.chkForm;
var i, flg = 0;
for( i=0; i<x.grp.length; i++ )
{
if(x.grp[i].checked)
flg=1;
}
if(!flg)
{
alert("Select One");
return false;
}
}
</script>
</head>
<body>
<form name="chkForm" method="POST" action="#" onsubmit="return valBox();">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table1">
<tr>
<td><input type="radio" value="V1" name="grp">1</td>
</tr>
<tr>
<td><input type="radio" value="V2" name="grp">2</td>
</tr>
<tr>
<td><input type="radio" value="V3" name="grp">3</td>
</tr>
<tr>
<td><input type="submit" value="Submit" name="B1"></td>
</tr>
</table>
</div>
</form>
</body>
</html>
Friday, May 30, 2008
Number to currency format conversion - Indian Rupees - in PHP
The following code can be used to convert the number format into indian currency format (Indian rupees, INR) using PHP.
<?php
ob_start();
//Currency format conversion - Indian Rupee
$n = "1000000";
$len = strlen($n); //lenght of the no
$num = substr($n,$len-3,3); //get the last 3 digits
$n = $n/1000; //omit the last 3 digits already stored in $num
while($n > 0) //loop the process - further get digits 2 by 2
{
$len = strlen($n);
$num = substr($n,$len-2,2).",".$num;
$n = round($n/100);
}
echo "Rs.".$num;
?>
<?php
ob_start();
//Currency format conversion - Indian Rupee
$n = "1000000";
$len = strlen($n); //lenght of the no
$num = substr($n,$len-3,3); //get the last 3 digits
$n = $n/1000; //omit the last 3 digits already stored in $num
while($n > 0) //loop the process - further get digits 2 by 2
{
$len = strlen($n);
$num = substr($n,$len-2,2).",".$num;
$n = round($n/100);
}
echo "Rs.".$num;
?>
Friday, May 23, 2008
No of days between two dates in php
We can find the no days between two dates using PHP....
There are 2 methods:
1) Split the date and subtract
$date1 = "2008-05-18";
$arr = explode('-',$date1); //split the date
$date2 = $arr[2]; //stores 18
$cur_date = date("d"); // current date
echo "Difference: ";
echo $cur_date-$date2;
2) Convert dates into timestamp, subtract and then convert as we want
$date1 = "2008-04-18";
$to_day = date("Y-m-d"); //current date
$day_diff = (strtotime($to_day)-strtotime($date1))/86400; //60*60*24=86400
echo $day_diff;
//change the divider(864000 to get ur corresponding difference
$hour_difference = (strtotime($to_day)-strtotime($date1))/3600; //60*60=3600
$week_diff = (strtotime($to_day)-strtotime($date1))/604800; //60*60*24*7=604800
There are 2 methods:
1) Split the date and subtract
$date1 = "2008-05-18";
$arr = explode('-',$date1); //split the date
$date2 = $arr[2]; //stores 18
$cur_date = date("d"); // current date
echo "Difference: ";
echo $cur_date-$date2;
2) Convert dates into timestamp, subtract and then convert as we want
$date1 = "2008-04-18";
$to_day = date("Y-m-d"); //current date
$day_diff = (strtotime($to_day)-strtotime($date1))/86400; //60*60*24=86400
echo $day_diff;
//change the divider(864000 to get ur corresponding difference
$hour_difference = (strtotime($to_day)-strtotime($date1))/3600; //60*60=3600
$week_diff = (strtotime($to_day)-strtotime($date1))/604800; //60*60*24*7=604800
Monday, May 19, 2008
Checkbox array problem with Javascript and PHP
Check this solution...
Here we can use the checkbox array.... no problem with both php get data and javascipt validation.
<?php
if(isset($_REQUEST['lang']))
{
$lang=$_REQUEST['lang'];
foreach ($lang as $language)
{
echo "$language is checked <br />";
}
echo "Selected Array: ";
print_r($lang);
}
?>
<html>
<head>
<title>TEST</title>
<script language="javascript">
function chkThis()
{
var chkList = document.chkForm['lang[]'];
for(var i = 0 ; i < chkList.length ; i++)
{
if(chkList[i].checked)
alert(chkList[i].value);
}
}
</script>
</head>
<body>
<form method="post" action="#" name="chkForm" onsubmit="return chkThis();">
Please choose language:<br />
<input type="checkbox" name="lang[]" value="JAVA">JAVA><br />
<input type="checkbox" name="lang[]" value="VB">VB<br />
<input type="checkbox" name="lang[]" value="PHP">PHP<br />
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>
Here we can use the checkbox array.... no problem with both php get data and javascipt validation.
<?php
if(isset($_REQUEST['lang']))
{
$lang=$_REQUEST['lang'];
foreach ($lang as $language)
{
echo "$language is checked <br />";
}
echo "Selected Array: ";
print_r($lang);
}
?>
<html>
<head>
<title>TEST</title>
<script language="javascript">
function chkThis()
{
var chkList = document.chkForm['lang[]'];
for(var i = 0 ; i < chkList.length ; i++)
{
if(chkList[i].checked)
alert(chkList[i].value);
}
}
</script>
</head>
<body>
<form method="post" action="#" name="chkForm" onsubmit="return chkThis();">
Please choose language:<br />
<input type="checkbox" name="lang[]" value="JAVA">JAVA><br />
<input type="checkbox" name="lang[]" value="VB">VB<br />
<input type="checkbox" name="lang[]" value="PHP">PHP<br />
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>
Friday, May 16, 2008
Checkbox validation in Javascirpt
Try this:
Change checkbox values and click button.....
<form name="test">
<input type="checkbox" name="checkgroup" checked />
<input type="checkbox" name="checkgroup" />
<input type="checkbox" name="checkgroup" checked />
<input type="button" value="Button" name="B1" onclick="check_boxes();"></form>
<script type="text/javascript">
function check_boxes()
{
for (i=0; i<document.test.checkgroup.length; i++){
if (document.test.checkgroup[i].checked==true)
alert("Checkbox at index "+i+" is checked!")
}
}
</script>
From: http://www.javascriptkit.com/jsref/checkbox.shtml
Change checkbox values and click button.....
<form name="test">
<input type="checkbox" name="checkgroup" checked />
<input type="checkbox" name="checkgroup" />
<input type="checkbox" name="checkgroup" checked />
<input type="button" value="Button" name="B1" onclick="check_boxes();"></form>
<script type="text/javascript">
function check_boxes()
{
for (i=0; i<document.test.checkgroup.length; i++){
if (document.test.checkgroup[i].checked==true)
alert("Checkbox at index "+i+" is checked!")
}
}
</script>
From: http://www.javascriptkit.com/jsref/checkbox.shtml
Wednesday, May 7, 2008
Changing Max upload file size in php
We can change the maximum file size of uploading in 2 ways.
1) using ini_set()
if you want to set it to 8 MB try: ini_set('max_upload_filesize', 8388608);
and not : ini_set('max_upload_filesize', 8M);
2) or using .htaccess file
in .htaccess file put this line:
php_value upload_max_filesize 8M
php_value post_max_size 8M
1) using ini_set()
if you want to set it to 8 MB try: ini_set('max_upload_filesize', 8388608);
and not : ini_set('max_upload_filesize', 8M);
2) or using .htaccess file
in .htaccess file put this line:
php_value upload_max_filesize 8M
php_value post_max_size 8M
Friday, April 25, 2008
Change the colour of scrollbars using css
This code will change the color or scroll bar of the window:
body {
scrollbar-3dlight-color:#ffd700;
scrollbar-arrow-color:#ff0;
scrollbar-base-color:#ff6347;
scrollbar-darkshadow-color:#ffa500;
scrollbar-face-color:#008080;
scrollbar-highlight-color:#ff69b4;
scrollbar-shadow-color:#f0f
}

Will work in IE, but not in FF.
From:
http://websitetips.com/articles/css/scrollbars/
body {
scrollbar-3dlight-color:#ffd700;
scrollbar-arrow-color:#ff0;
scrollbar-base-color:#ff6347;
scrollbar-darkshadow-color:#ffa500;
scrollbar-face-color:#008080;
scrollbar-highlight-color:#ff69b4;
scrollbar-shadow-color:#f0f
}
Will work in IE, but not in FF.
From:
http://websitetips.com/articles/css/scrollbars/
Subscribe to:
Posts (Atom)