By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

Corresponding links to another file to be displayed in iframe

P: 93
Hi,

Can someone give ideas on how should I do this task?
I've made a simple timeline using <td> and when I mouseover the cell I want it to link to another list of something and it will corresponding to it.
Eg..in my timeline say
cellwidth1->keyFrame1
cellwidth2->keyFrame2
cellwidth3->keyFrame3
....

keyFrame1,2,3..is from another file.

[html]

1.
foreach($allEvents as $timeline)
2.
{
3.
.....
4.
.....
5.
.....
6.

7.
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#4A8A00" onMouseOver="this.style.background ='#9CCB52'" onMouseOut="this.style.background='#4A8A00'"></td>
8.
...
9.
....
[/html]


and this is the second file to be link

[html]

1.
....
2.
....
3.
<td width="65" valign="top" width="65" height="44" border="1" vspace="2">
4.
<img src="<?php echo $keyFrame;?>"
5.
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>)"></td>
6.
...
7.
...

[/html]



the display is in the iframe in the first file. The iframe name=eventsDisplay. Should I use onClick?

Thanks

nma
Jan 31 '08 #1
Share this Question
Share on Google+
14 Replies


acoder
Expert Mod 15k+
P: 16,027
I'm not sure I quite follow. What exactly is supposed to happen when you mouseover besides the background changing colour?
Feb 1 '08 #2

P: 93
nma
I'm not sure I quite follow. What exactly is supposed to happen when you mouseover besides the background changing colour?

Hi

When I mouseover the cell color will change and when I click the cell <td> it will play the selected video and I want also the keyframe image from the second file display inside the iframe. The keyframe image is actually the same meaning when I click on it in the iframe it will also play the specified video assign to it. The iframe is part of the first file.

Thanks
Feb 1 '08 #3

acoder
Expert Mod 15k+
P: 16,027
How much of it do you have working so far? Can you post the generated HTML or a shorter version of it (if too long)?
Feb 1 '08 #4

P: 93
nma
How much of it do you have working so far? Can you post the generated HTML or a shorter version of it (if too long)?


this is the first file..

[HTML]
<?php
session_start();

// Make sure users are logged in.
if(!isset($_SESSION['user'])) {
header('Location: /...html');
die();
}
?>
<?php
include_once('../ez_sql.php');
$movie = $db->get_row("select * from Movie where movieID='" . $_GET['movieID'] . "'");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Browse-Search-Note Movies</title>
<link rel="stylesheet" href="moviebrowser2.css" type="text/css" title="Default" media="screen"/>

<SCRIPT LANGUAGE="JavaScript">
....

..

...

...

<script type="text/javascript">

..functions...

.......


</script>
</head>

<body background="left-bar.jpg" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" width="22"><img src="../login-vline.jpg" width="22" height="6" /></td>
<td width="99%" height="78" valign="bottom" background="/../topbar-background.jpg"><a href="/../MB2mainscreen.php"><img src="/../logo.jpg" width="250" height="52" vspace="1" hspace="0" border="0" /></a><img src="/../theme.jpg" width="422" height="11" vspace="31" hspace="0"/></td>
.......
.....
<tr> <!--start timeline table -->
<td class="timeline_text1" colspan="2">
<table width="750" cellspacing="0" border="0" cellpadding="0">

<table cellspacing="1" border="0" cellpadding="0">

</table>
</td>
<td>
<table width="650" cellspacing="1" border="0" cellpadding="0" bgcolor="#525100">
<tr>

<!-- use td cell color EXCITING-->
<?php

$allEvents = $db->get_results("SELECT * FROM EventsShotsStartAndStopFrames where movieID='" . $_GET['movieID'] . "' and eventCategory = 'Exciting' order by eventNo");
$prevTime = 0;

foreach($allEvents as $timeline)
{
$frameDuration = ($timeline->shotStartFrame) - $prevTime;
$cellwidth = round(($frameDuration * 700)/ $theLengthFrames);//round here
?>

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#525100"></td>

<?php
$frameDuration = ($timeline->shotStopFrame) - ($timeline->shotStartFrame);
$cellwidth = round(($frameDuration * 700)/ $theLengthFrames);//round here

$shotStartTime = $timeline->shotStartFrame/29.97;
if(is_int($timeline->shotStartFrame)) {
$shotStopTime = $timeline->shotStopFrame/29.97;
}
else {
$shotStopTime = 0;
}


?>

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFFF00" onMouseOver="this.style.background ='#FFFFFF'"
onMouseOut="this.style.background='#FFFF00'" onclick="parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();"><a href="/../MB2eventlist.php"?movieID=<?php echo $movie->movieID;?>&target="eventsDisplay">bar</a></td>



<?php
$prevTime = ($timeline->shotStopFrame);
}
?>

<!-- exciting area-->

</tr>
</table>
</td>

</tr> <!--end of timeline table -->
....
.....
<!-- Event list Display-->
<iframe name="eventsDisplay" height="500" width="280" marginwidth="2" marginheight="1" scrolling="auto" frameborder="0" src="/../MB2movieinfo.php?movieID=<?php echo $movie->movieID?>&keepThis=true&TB_iframe=true&height=500 &width=650" align="center"> </iframe></td>
<td width="450" align="right" valign="top">
<!-- Player panel + Notes -->
<table width="468" border="0" cellspacing="0" cellpadding="1">
<tr height="462">
<td height="460" align="center" valign="top">
<span width="460" height="430" id="vlc_container" style="display: block;">
<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
width="460" height="400" events="True" id="vlc">
<param name="Src" value="" />
<param name="ShowDisplay" value="True" />
<param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" />
<param name="Volume" value="50" />
<embed pluginspage="http://www.videolan.org"
type="application/x-vlc-plugin"
progid="VideoLAN.VLCPlugin.2"
width="460"
height="400"
name="vlc"> </embed>
</object>
<div class="slider" id="slider-1" tabIndex="1" style="width:460px;"><input class="slider-input" id="slider-input-1" name="slider-input-1"/></div>
</span>
<span id="status_message" style="font-size:18pt;width:460px;text-align:center;"></span> </td>
</tr>
<tr>
<td align="left">

<form id="vlc_controls">
<table cellspacing="0" cellpadding="2">
<tr>
<td><input name="button" type="button" id="vlc_play" value="Pause" /></td>
<td><input name="button2" type="button" id="vlc_stop" value="Stop" /></td>
<!--<td><input type="button" value="Slower" id="vlc_slower" /> </td>
<td><input type="button" value="Faster" id="vlc_faster" /></td>-->
<td><input type="button" value="FullScreen" id="vlc_fullscreen" /></td>
<td><input type="button" value="Vol Down" id="vlc_downvolume" /><span id="vlc_volumelevel">70%</span><input type="button" value="Vol Up" id="vlc_upvolume" /></td>
<td><input type="button" value="Mute" id="vlc_mute" /> </td>
</tr>
</table>
</form> </td>
</tr>
</table> </td>
</tr>
<tr>
<td height="50">


....
.....
</td>
</tr>
</table>
</td>
</tr>

</table>
</td>
</tr>
</table>

</body>
</html>



[/HTML]
Feb 1 '08 #5

P: 93
nma
How much of it do you have working so far? Can you post the generated HTML or a shorter version of it (if too long)?

this is the second file to be link..

[PHP]
This is the codes in second file (MB2eventlist.php) that I need to link.
Code: ( php )

1.
<?php
2.
session_start();
3.

4.
// Make sure users are logged in.
5.
if(!isset($_SESSION['user'])) {
6.
header('Location: /..');
7.
die();
8.
}
9.

10.

11.
function sec2hms ($sec, $padHours = false)
12.
{
13.

14.
.....
15.
return $hms;
16.

17.
}
18.

19.
?>
20.
<?php
21.
include_once('../ez_sql.php');
22.
$movieID = $_GET['movieID'];
23.
$pageName = $_SERVER['PHP_SELF'];
24.

25.
?>
26.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
27.
<html xmlns="http://www.w3.org/1999/xhtml">
28.
<head>
29.
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
30.
<title>Browse-Search</title>
31.
<link rel="stylesheet" href="...css" type="text/css" title="Default" media="screen"/>
32.
</head>
33.

34.
<body bgcolor="#726257" background="iframe-background.jpg" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="width:260px;overflow:hidden;">
35.
<table width="270" border="0" cellspacing="0" cellpadding="0">
36.

37.
<?php
38.

39.
function insertEventTableRow($movieID, $eventID, $keyFrame, $startTime, $stopTime, $eventInformation) {
40.
?>
41.
<tr bgcolor="#726257" onMouseOver="this.bgColor='#534741';" onMouseOut="this.bgColor='#726257';" style="cursor: pointer;">
42.
<td width="65" valign="top" width="65" height="44" border="1" vspace="2">
43.
<img src="<?php echo $keyFrame;?>"
44.
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
45.

46.
</td>
47.
<td width="195" class="eventEntryText" onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
48.
<?php echo $eventInformation?>
49.
</td>
50.
</tr>
51.
<tr>
52.
<td colspan="2" height="5">
53.
<img src="iframe-borderline.jpg" width="230" height="5"/>
54.
</td>
55.
</tr>
56.
<?php
57.
}
58.

59.
$events = (isset($_REQUEST['events']))?$_REQUEST['events']:"All";
60.
switch($events) {
61.
case "All":
62.
break;
63.
case "Dialogue":
64.
case "Montage":
65.
case "Exciting":
66.

67.
$db->query("INSERT INTO LogsTable (page, action, userID, type, date) VALUES ('MB2eventlist', '$events categories', " . $_SESSION['user']->userID . ", '', getDate())");
68.

69.
$allEvents = $db->get_results("SELECT * FROM EventsShotsStartAndStopFrames where movieID='$movieID' and eventCategory = '$events' order by eventNo");
70.
foreach($allEvents as $event)
71.
{
72.

73.
$shotStartTime = $event->shotStartFrame/29.97;
74.

75.
if(is_int($event->shotStartFrame)) {
76.
$shotStopTime = $event->shotStopFrame/29.97;
77.
}
78.
else {
79.
$shotStopTime = 0;
80.
}
81.

82.
$numberOfShotsInEvent = $event->endShot - $event->startShot;
83.
$eventInformation = "<b>$events " . $event->eventNo . "</b><br />($numberOfShotsInEvent shots)<br />";
84.
$eventInformation .= '<em style="font-size:smaller;">' . sec2hms($shotStartTime) . " - " . sec2hms($shotStopTime).'</em>';
85.

86.
insertEventTableRow($_GET['movieID'], $event->eventID, $event->imgSelectedKeyfrm, $shotStartTime, $shotStopTime, $eventInformation);
87.

88.
}
89.
break;
90.
default:
91.
die("Invalid Event!");
92.
break;
93.
}
94.

95.
?>
96.

97.
</table>
98.
</body>
99.
</html>


[/PHP]
Feb 1 '08 #6

acoder
Expert Mod 15k+
P: 16,027
You've posted the PHP code. Post the generated HTML and not all the code - just the relevant parts. Which part is not working as you want it to? Do you get any errors?
Feb 2 '08 #7

P: 93
nma
Hi
Is there anything wrong with this codes below?
I want to click on the td cell and display the output in the iframe called 'eventsDisplay'

Thansk

nma


[HTML]

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFCBCE" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFCBCE'" onClick="frames.location.href="/Timeline.php?movieID=<?php echo $movie->movieID;?>& events=<?php echo $timeline->eventCategory;?>" target="eventsDisplay"></td>
[/HTML]
Feb 5 '08 #8

iam_clint
Expert 100+
P: 1,208
ya theres a problem.. frames.location.href which frame...


document.frames."nameofframe".location =
Feb 5 '08 #9

P: 93
nma
ya theres a problem.. frames.location.href which frame...


document.frames."nameofframe".location =

[HTML]

onClick="document.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>'"
[/HTML]


it works!!! thanks
Feb 5 '08 #10

P: 93
nma
[HTML]

onClick="document.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>'"
[/HTML]


it works!!! thanks
How am i going to combine these codes for onClick together in one td cell? I try to combine like this but error

[HTML]

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFCBCE" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFCBCE'" onClick="document.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>' "></td>
[/HTML]
with this code below..
[HTML]
onclick="parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();
[/HTML]

the combine codes that i try....
[HTML]
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFCBCE" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFCBCE'" onClick="document.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>' "parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();"></td>

[/HTML]
Feb 5 '08 #11

P: 93
nma
How am i going to combine these codes for onClick together in one td cell? I try to combine like this but error

[HTML]

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFCBCE" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFCBCE'" onClick="document.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>' "></td>
[/HTML]
with this code below..
[HTML]
onclick="parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();
[/HTML]

the combine codes that i try....
[HTML]
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFCBCE" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFCBCE'" onClick="document.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>' "parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();"></td>

[/HTML]
HI all
I manage to solve it, i just put ; in between the two onclick attribute

nma
Feb 5 '08 #12

acoder
Expert Mod 15k+
P: 16,027
Just a note that it should be window.frames, not document.frames. The latter will work in IE, but the former will work in all browsers.
Feb 5 '08 #13

P: 93
nma
Just a note that it should be window.frames, not document.frames. The latter will work in IE, but the former will work in all browsers.
thank you for the informaiton

nma
Feb 5 '08 #14

acoder
Expert Mod 15k+
P: 16,027
No problem!
Feb 5 '08 #15

Post your reply

Sign in to post your reply or Sign up for a free account.