Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

functions won't execute onclick 1

Status
Not open for further replies.

ksquared3

Programmer
Sep 2, 2007
18
US
Though I have declared both functions in <head>, they will not execute. The file that calls the functions is a php include. The main file is painting.php. I hope this isn't too much information. Thanks!

Here are the two functions:
Code:
function directionBack()
{
document.write("Im here in directionBack");
if (count > 1)
count = count - 1;
return count;
}

Code:
function imageToDiv(count)
{
document.write("Im here in imageToDiv");
imageURL = "<img src=\'images/painting_\' + count + \'.jpg' />";
document.getElementById("imagediv").innerHTML = imageURL
return false;
document.write(count);
document.write(imageURL);
}

The file that calls the functions onclick.
Code:
<a href="" id="link1" class='link'><img src='images/braceL.gif' alt='brace' width='20' height='11' valign='text-bottom' onFocus="if(this.blur)this.blur)" onclick="directionBack(); imageToDiv(count)"/></a>
     <a href="thumbnails.php" class="linkCurrent" target="_self" onFocus="if(this.blur)this.blur)" />PAINTINGS</a>
     <a href="painting_<?php echo $paintingNext; ?>.php" class="link" target="_self" onFocus="if(this.blur)this.blur()" /><img src="images/braceR.gif" alt="brace" width="20" height="14" valign="text-bottom" onFocus="if(this.blur)this.blur()" /></a>

The main file.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en-US" lang="en-US">
<?php $thisPage="fullPainting"; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/directionBack.js"></script>
<script type="text/javascript" src="scripts/imageToDiv.js"></script>
<script type="text/javascript">
var count;
var imageURL;
</script>
<script type="text/javascript">
function directionBack()
{
if (count > 1)
count = count - 1;
return count;
}
</script>
<script type="text/javascript">
function imageToDiv(count)
{
imageURL = "<img src=\'images/painting_\' + count + \'.jpg' />";
document.getElementById("imagediv").innerHTML = imageURL
return false;
}
</script>
<title>STEPHANIE PEEK</title>
</head>
<body>

<div id="center" align="center">
	<div id="container">
	  <div id="main">
      	<?php
  		$paintingNumber = $_REQUEST["paintingNumber"];
	   	?>
        <?php include ("includes/topNav.php"); ?>
        <div class="clear"></div>
        <div class="painting" id="imagediv"><img src="images/painting_<? echo $paintingNumber; ?>.jpg" /></div>
        <div class="clear"></div>
        <div class="caption">
        	<?php include ("includes/caption.php"); ?>
        </div><!--caption -->
   	  </div><!--end main -->
	</div><!--end container -->
</div><!--end center -->
</body>
</html>[code]
 
feherke, the forward and back navigation does not target html pages, but paintings in an array. The painting.php page is the only page to display the larger picture.
 
Thanks, Dian. Tried to "thank you" thru the app, didn't work. So, I'm thanking 'in person'!
 
Hi

ksquared3 said:
the forward and back navigation does not target html pages, but paintings in an array.
From your answer I deduce that I was not clear. By "keyboard navigation" I mean tabbing navigation :
[ul]
[li]press Tab and/or Shift-Tab to move the focus to the desired link[/li]
[li]press Enter to activate the link[/li]
[/ul]
Your [tt]blur()[/tt] method calls removes the focus from the links, so the visitor can not select them by pressing Tab/Shift-Tab.

Better do not ruin your site's accessibility, if not really necessary.
See Web Content Accessibility Guidelines (WCAG) 2.0 | Principle 2: Operable - User interface components and navigation must be operable. | Guideline 2.1 Keyboard Accessible: Make all functionality available from a keyboard. for more.


Feherke.
 
Aha, since I never tab to links, I hadn't a clue that some do. I'll certainly consider it. I did the onFocus blur to prevent the dotted line from circling the link when activated. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top