Using php or javascript to change picture in a webpage according to some sort of url code -
right have simple website looks this. http://i.imgur.com/opllm1y.png
i need way change image , description @ same time keep navbar , title same not want 100s of pages on website.
would best put image url's database , call out php along description?
or there way it.
does content need change without leaving page? if so, using jquery , ajax.
goto jquery offical web site, , download javascript file them, upload server.
just before closing tag body, insert this:
<script src="your.jquery.file.js" type="text/javascript" ></script>
now, on page, simple way make sure img , div tags have id's:
<img id="image_to_change src="start.png"> <div id="text_content"></div>
after script tag included, use script tag, time, we're gonna put javascript of our own in here
<script type="text/javascript"> $(document).ready(function(){ $('#image_to_change').onclick(function(){ $('#image_to_change').attr('src', 'next_image.png'); $('#text_content').text("the text want insert"); }); }); </script>
this of course crude, should give starting point.
Comments
Post a Comment