onclick with anchor link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nma
    New Member
    • Aug 2007
    • 93

    onclick with anchor link

    Hi

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

    [HTML]

    <td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#00ff0 0" onMouseOver="th is.style.backgr ound ='red'"
    onMouseOut="thi s.style.backgro und='#00ff00'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>'; parent.playClip (<?php echo $timeline->eventID?>, <?php echo $shotStartTime? >, <?php echo $shotStopTime?> );parent.notesF orm.eventID.val ue=<?php echo $timeline->eventID?>;pare nt.resetNotes() ;"></td>

    [/HTML]

    Below is link file MB2eventlistTim eline.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.dt d">
    <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="moviebrow ser2.css" type="text/css" title="Default" media="screen"/>
    </head>

    <body bgcolor="#72625 7" background="ifr ame-background.jpg" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0 " marginwidth="0" marginheight="0 " style="width:26 0px;overflow:hi dden;">
    <table width="270" border="0" cellspacing="0" cellpadding="0" >

    <?php

    function insertEventTabl eRow($movieID, $eventID, $keyFrame, $startTime, $stopTime, $eventInformati on) {
    ?>
    <tr bgcolor="#72625 7" onMouseOver="th is.bgColor='#53 4741';" onMouseOut="thi s.bgColor='#726 257';" 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;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.resetNotes() ;">
    </td>
    <td width="195" class="eventEnt ryText" onclick="parent .playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.resetNotes() ;">
    <?php echo $eventInformati on?>
    </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("INSER T INTO LogsTable (page, action, userID, type, date) VALUES ('timeline', '$events categories', " . $_SESSION['user']->userID . ", '', getDate())");

    $allEvents = $db->get_results("S ELECT * FROM EventsShotsStar tAndStopFrames where movieID='$movie ID' and eventCategory = '$events' order by eventNo");

    foreach($allEve nts as $event)
    {

    $shotStartTime = $event->shotStartFra me/29.97;

    if(is_int($even t->shotStartFrame )) {
    $shotStopTime = $event->shotStopFram e/29.97;
    }
    else {
    $shotStopTime = 0;
    }

    $numberOfShotsI nEvent = $event->endShot - $event->startShot;
    $eventInformati on = "<b>$events " . $event->eventNo . "</b><br />($numberOfShot sInEvent shots)<br />";
    $eventInformati on .= '<em style="font-size:smaller;"> ' . sec2hms($shotSt artTime) . " - " . sec2hms($shotSt opTime).'</em>';

    //insertEventTabl eRow($movieID, $event->eventID, $event->imgSelectedKey frm, $shotStartTime, $shotStopTime, $eventInformati on);
    insertEventTabl eRow($_GET['movieID'], $event->eventID, $event->imgSelectedKey frm, $shotStartTime, $shotStopTime, $eventInformati on);
    }
    break;
    default:
    die("Invalid Event!");
    break;
    }

    ?>

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


    [/HTML]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Use <a name="#somethin g"> where you want to link to and then link to that when changing the location, e.g. MB2eventlistTim eline.php?...#s omething.

    Comment

    • nma
      New Member
      • Aug 2007
      • 93

      #3
      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="#FFA29 C" onMouseOver="th is.style.backgr ound ='red'"
      onMouseOut="thi s.style.backgro und='#FFA29C'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>'; parent.playClip (<?php echo $timeline->eventID?>, <?php echo $shotStartTime? >, <?php echo $shotStopTime?> );parent.notesF orm.eventID.val ue=<?php echo $timeline->eventID?>;pare nt.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;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.resetNotes() ; name="<?php echo $eventID?>";">

      [/PHP]

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        [code=javascript]onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>#eventID';[/code]

        Comment

        • nma
          New Member
          • Aug 2007
          • 93

          #5
          Originally posted by acoder
          [code=javascript]onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>#eventID';[/code]

          [PHP]

          <td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29 C" onMouseOver="th is.style.backgr ound ='red'"
          onMouseOut="thi s.style.backgro und='#FFA29C'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>#eventID'; parent.playClip (<?php echo $timeline->eventID?>, <?php echo $shotStartTime? >, <?php echo $shotStopTime?> );parent.notesF orm.eventID.val ue=<?php echo $timeline->eventID?>;pare nt.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;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.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

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            I think you are missing two things.

            1. I couldn't find anything like <a name="anchor_na me"></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.

            Comment

            • nma
              New Member
              • Aug 2007
              • 93

              #7
              Originally posted by hsriat
              I think you are missing two things.

              1. I couldn't find anything like <a name="anchor_na me"></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="#FFA29 C" onMouseOver="th is.style.backgr ound ='red'"
              onMouseOut="thi s.style.backgro und='#FFA29C'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>#eventID'; parent.playClip (<?php echo $timeline->eventID?>, <?php echo $shotStartTime? >, <?php echo $shotStopTime?> );parent.notesF orm.eventID.val ue=<?php echo $timeline->eventID?>;pare nt.resetNotes() ;" style="cursor: pointer;"></td>
              [/PHP]
              view source
              <td width="7" height="17" bgcolor="#FFA29 C" onMouseOver="th is.style.backgr ound ='red'"
              onMouseOut="thi s.style.backgro und='#FFA29C'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=1&events=Mo ntage#eventID'; parent.playClip (25, 3185.55221889, 3234.43443443); parent.notesFor m.eventID.value =25;parent.rese tNotes();" 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;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.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.notesFor m.eventID.value =23;parent.rese tNotes();"><a name="eventID"> </a>

              Comment

              • hsriat
                Recognized Expert Top Contributor
                • Jan 2008
                • 1653

                #8
                Try this...[php]<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29 C" onMouseOver="th is.style.backgr ound ='red'" onMouseOut="thi s.style.backgro und='#FFA29C'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>#<?php echo $timeline->eventID?>'; parent.playClip (<?php echo $timeline->eventID?>, <?php echo $shotStartTime? >, <?php echo $shotStopTime?> );parent.notesF orm.eventID.val ue=<?php echo $timeline->eventID?>;pare nt.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;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.resetNotes() ;">
                [/php]

                Comment

                • nma
                  New Member
                  • Aug 2007
                  • 93

                  #9
                  Originally posted by hsriat
                  Try this...[php]<td width="<?php echo ($cellwidth); ?>" height="17" bgcolor="#FFA29 C" onMouseOver="th is.style.backgr ound ='red'" onMouseOut="thi s.style.backgro und='#FFA29C'" onClick="window .frames.eventsD isplay.location = 'MB2eventlistTi meline.php?movi eID=<?php echo $movie->movieID;?>&eve nts=<?php echo $timeline->eventCategory; ?>#<?php echo $timeline->eventID?>'; parent.playClip (<?php echo $timeline->eventID?>, <?php echo $shotStartTime? >, <?php echo $shotStopTime?> );parent.notesF orm.eventID.val ue=<?php echo $timeline->eventID?>;pare nt.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;?>);p arent.notesForm .eventID.value= <?php echo $eventID?>;pare nt.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

                  Comment

                  • hsriat
                    Recognized Expert Top Contributor
                    • Jan 2008
                    • 1653

                    #10
                    Originally posted by nma
                    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.

                    Comment

                    • nma
                      New Member
                      • Aug 2007
                      • 93

                      #11
                      Originally posted by hsriat
                      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

                      Comment

                      • hsriat
                        Recognized Expert Top Contributor
                        • Jan 2008
                        • 1653

                        #12
                        Originally posted by nma
                        ..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

                        Comment

                        Working...