Is there some way I can loop through this code? using Ajax? Thanks for any recommendations.

<?php
    $paintingBack=$paintingNumber-1;
    $paintingNext=$paintingNumber+1;
    if ($paintingBack < 1) {
    $paintingBack = $paintingBack + 1;} ?>
	
    <a href="" id="link1" class='link'><img src='images/braceL.gif' alt='brace' width='20' height='11' valign='text-bottom'/></a>
	<script type="text/javascript">
	
	var l = document.getElementById("link1");
	l.onFocus = function() {
    if(this.blur)this.blur();
	}
	l.onclick = function() {
    document.getElementById("imagediv").innerHTML = "<img src='images/painting_<? echo $paintingBack; ?>.jpg />'";
    return false;
	}
	</script>

Recommended Answers

All 4 Replies

what do you mean loop in this code, do you mean accessing this code several types from javascript using AjAX?

what do you mean loop in this code, do you mean accessing this code several types from javascript using AjAX?

I did mean that way back a day ago, but the code and my understanding have changed dramatically since then. Thank you for your reply. Just for learning's sake, tho, wondering if that was possible? Please don't bother, if you're otherwise engaged.

yes it is possible

Thanks! I'll figure that out when I have some time. If I don't have a goal for learning, I'm too lazy to do it =\

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.