value from child page to mother

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

value from child page to mother

Post by pleigh »

i have a child code here

Code: Select all

//months array
	$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
	
	//dropdown
	echo '<select name="startmonth">';
	echo "<option value=\"\">Month</option><br>";
	foreach ($months as $key => $value) 
	{
		echo "<option value=\"$key\">$value</option>\n";
	}
	echo '</select>
	<select name="startday">';
	echo "<option value=\"\">Day</option><br>";
	for ($day = 1; $day <= 31; $day++) 
	{
		echo "<option value=\"$day\">$day</option>\n";
	}
	echo '</select>
	<select name="startyear">';
	echo "<option value=\"\">Year</option><br>";
	$year = 2005;
	while ($year <= 2010) 
	{
		echo "<option value=\"$year\">$year</option>\n";
		$year++;
	}
	echo '</select>';
upon filling up the form(selecting the date), i want its value to pass to the mother page....i know it can be done through javascript but i have little knowledge of javascript...i hope you can help me guys...thanks in advance :)

( JAM | Moved )
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

What do you mean by child and mother ??? is the form inside an IFRAME ? or inside a different frame ?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I'm guessing this should be in Client Side :P

Either way you need an event to trigger the passing to the parent page. Perhaps an onMouseOver or onChange in your select boxes. Then you'd pass the information to a function on the parent page.

Code: Select all

onChange="document.functionName('data');"

// Sample function

<script language="text/javascript">
<!--
function functionName(data)
{
   document.getElementById("date").innerHTML = '<p>'+date+'</p>';
}
//-->
Something along those lines. My javascript is scarce as well.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply