471,056 Members | 1,558 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,056 software developers and data experts.

onclick with anchor link

93
Hi

How can I make the anchor link once I do onclick?

[HTML]

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#00ff00" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#00ff00'" onClick="window.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]

Below is link file MB2eventlistTimeline.php. I want it to display the result at the beginning list without using the scrolbar. Currently it list the whole file in the iframe. I want it to go to specific point in the iframe display according to the variable it sent or if possible highlighted current location

[HTML]
<!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"/>
</head>

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

<?php

function insertEventTableRow($movieID, $eventID, $keyFrame, $startTime, $stopTime, $eventInformation) {
?>
<tr bgcolor="#726257" onMouseOver="this.bgColor='#534741';" onMouseOut="this.bgColor='#726257';" style="cursor: pointer;">
<td width="65" valign="top" width="65" height="44" border="1" vspace="2">
<img src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
</td>
<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();">
<?php echo $eventInformation?>
</td>
</tr>
<tr>
<td colspan="2" height="5">
<img src="iframe-borderline.jpg" width="230" height="5"/>
</td>
</tr>
<?php
}

$events = (isset($_GET['events']))?$_GET['events']:"All"; //just call one time only..no need to defin on top of the line like $movieID
switch($events) {
case "All":
break;
case "Dialogue":
case "Montage":
case "Exciting":

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

$allEvents = $db->get_results("SELECT * FROM EventsShotsStartAndStopFrames where movieID='$movieID' and eventCategory = '$events' order by eventNo");

foreach($allEvents as $event)
{

$shotStartTime = $event->shotStartFrame/29.97;

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

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

//insertEventTableRow($movieID, $event->eventID, $event->imgSelectedKeyfrm, $shotStartTime, $shotStopTime, $eventInformation);
insertEventTableRow($_GET['movieID'], $event->eventID, $event->imgSelectedKeyfrm, $shotStartTime, $shotStopTime, $eventInformation);
}
break;
default:
die("Invalid Event!");
break;
}

?>

</table>
</body>
</html>


[/HTML]
Feb 9 '08 #1
11 3792
acoder
16,027 Expert Mod 8TB
Use <a name="#something"> where you want to link to and then link to that when changing the location, e.g. MB2eventlistTimeline.php?...#something.
Feb 11 '08 #2
nma
93
Hi Again
I still could not solve this problem.. below is the code..
the anchor name is #eventID,
It does not show correct disply. It display by default from the first list.

Please help.

nma

[PHP]
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29C" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFA29C'" onClick="window.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();" style="cursor: pointer; "#<?php echo $timeline->eventID?>" "></td>


[/PHP]




[PHP]
<img style="border: solid 1px; border-color:#00ff00 " src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes(); name="<?php echo $eventID?>";">

[/PHP]
Feb 28 '08 #3
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>#eventID';
Feb 28 '08 #4
nma
93
Expand|Select|Wrap|Line Numbers
  1. onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>#eventID';

[PHP]

<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29C" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFA29C'" onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>#eventID'; parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();" style="cursor: pointer;"></td>

[/PHP]


[PHP]
<img style="border: solid 1px; border-color:#FFA29C" src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes(); name="<?php echo $eventID?>";">

[/PHP]

When I want to give anchor name based on eventID eg 17 and display will start at number 17
I do like above no error but display still from beginning. Where is went wrong?

Thanks
Feb 29 '08 #5
hsriat
1,654 Expert 1GB
I think you are missing two things.

1. I couldn't find anything like <a name="anchor_name"></a> in your code.
2. Anchor, which you are referring to is eventID, but not its value.


Please do the following:

1. Open your page in browser >> right click on the page >> click on view source >> copy the HTML source and post it here.
2. Also tell me what do you see in the address bar when you click on the link. Do post that address here.
Feb 29 '08 #6
nma
93
I think you are missing two things.

1. I couldn't find anything like <a name="anchor_name"></a> in your code.
2. Anchor, which you are referring to is eventID, but not its value.


Please do the following:

1. Open your page in browser >> right click on the page >> click on view source >> copy the HTML source and post it here.
2. Also tell me what do you see in the address bar when you click on the link. Do post that address here.



[PHP]
<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29C" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFA29C'" onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>#eventID'; parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();" style="cursor: pointer;"></td>
[/PHP]
view source
<td width="7" height="17" bgcolor="#FFA29C" onMouseOver="this.style.background ='red'"
onMouseOut="this.style.background='#FFA29C'" onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=1&events=Montage #eventID'; parent.playClip(25, 3185.55221889, 3234.43443443);parent.notesForm.eventID.value=25;p arent.resetNotes();" style="cursor: pointer;"></td>
[PHP]

<img style="border: solid 1px; border-color:#FFA29C" src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();"><a name="eventID"></a>
[/PHP]
view source...
<img style="border: solid 1px; border-color:#FFA29C" src="../moviebrowser/shrek/61212.jpg"
onclick="parent.playClip(23, 2033.56690023, 2059.95995996);parent.notesForm.eventID.value=23;p arent.resetNotes();"><a name="eventID"></a>
Feb 29 '08 #7
hsriat
1,654 Expert 1GB
Try this...[php]<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29C" onMouseOver="this.style.background ='red'" onMouseOut="this.style.background='#FFA29C'" onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>#<?php echo $timeline->eventID?>'; parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();" style="cursor: pointer;"></td>
[/php]
[php]
<a name="<?php echo $eventID?>"></a>
<img style="border: solid 1px; border-color:#FFA29C" src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
[/php]
Feb 29 '08 #8
nma
93
Try this...[php]<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29C" onMouseOver="this.style.background ='red'" onMouseOut="this.style.background='#FFA29C'" onClick="window.frames.eventsDisplay.location = 'MB2eventlistTimeline.php?movieID=<?php echo $movie->movieID;?>&events=<?php echo $timeline->eventCategory;?>#<?php echo $timeline->eventID?>'; parent.playClip(<?php echo $timeline->eventID?>, <?php echo $shotStartTime?>, <?php echo $shotStopTime?>);parent.notesForm.eventID.value=<? php echo $timeline->eventID?>;parent.resetNotes();" style="cursor: pointer;"></td>
[/php]
[php]
<a name="<?php echo $eventID?>"></a>
<img style="border: solid 1px; border-color:#FFA29C" src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
[/php]
Hi HSRIAT

It works..I can do the anchor link now...but again how do I make it at the same time hightlighted at the current position?

Many thanks :)

nma
Mar 3 '08 #9
hsriat
1,654 Expert 1GB
Hi HSRIAT

It works..I can do the anchor link now...but again how do I make it at the same time hightlighted at the current position?

Many thanks :)

nma
high-lightened? What do you want to high-lighten? I didn't get you.
Mar 3 '08 #10
nma
93
high-lightened? What do you want to high-lighten? I didn't get you.
..means the current position(anchor link) also change the color eg the background color
Mar 3 '08 #11
hsriat
1,654 Expert 1GB
..means the current position(anchor link) also change the color eg the background color
Then on the click event of the button, you can also add js code to change background color.
Look at this
Mar 3 '08 #12

Post your reply

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

Similar topics

53 posts views Thread by usenet | last post: by
8 posts views Thread by hobosalesman | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.