|
Posted by eholz1 on 02/26/07 21:42
Hello Group,
does this make sense?? I have some java code that responds to
keypress events (the arrow keys)
<script language="javascript">
<!--
function keypressed(e)
{
if (e.keyCode == 37) { document.location.href = 'images/?p=100'; }
else if (e.keyCode == 39) { document.location.href = 'viewpix.php?
p=1009&s=1'; }
}
The trick is the document.location.href can (and should) change as i
navigate thru image choices.
it is possible to use 37 to go back to an image document.location.href
= 'viewpix.php?p=100&s=1';
and 39 to go to next image: document.location.href = 'viewpix.php?
p=100&s=3';
this is a case where the image displayed is: document.location.href =
'viewpix.php?p=100&s=2';
I was thinking about making a php function that uses variables for the
href code , and then
echoing a string like this: (with appropriate dink marks, etc)
define these variables:
$back = 'images/?p="$p"';
$i = some number form $_REQUEST['id'];
$next = 'viewpix.php?p=$p&s="$i"';
echo '<script language="javascript">
<!--
function keypressed(e)
{
if (e.keyCode == 37) { document.location.href =
'$back'; }
}';
I would set the variable values, and then write the code in the page.
Any tips will help. the href stuff would change as the image changes.
Thanks,
eholz1
Navigation:
[Reply to this message]
|