nellisbasson
10-04-2012, 07:55 AM
Good day folk. I am making a website and have tried absolutely everything to find a way to make this work, with no avail.
I use jquery to insert a separate HTML file in a div, when clicked, and then in that again a separate HTML file when a link is clicked on that file.
So I have my homepage > index.html. then photography.html and then india.html and one for each country.
www.anetnepgen.co.za/test.html is what i have done sofar.
ok, so my code.
in my index.html file I have a forward and back button.
<div class="leftColumn">
<a onClick="changeImageright()" id="changeRight" style="color:#FFF;"><img src="forward.png" /></a>
<a onClick="changeImageleft()" id="changeLeft" style="color:#FFF;"><img src="backward.png" /></a>
</div>
It is handled by:
<script type="text/javascript">
var i=0;
var indiaarray = new Array("photos/india/1.jpg","photos/india/2.jpg","photos/india/3.jpg","photos/india/4.jpg","photos/india/5.jpg","photos/india/6.jpg","photos/india/7.jpg","photos/india/8.jpg","photos/india/9.jpg","photos/india/10.jpg","photos/india/11.jpg","photos/india/12.jpg","photos/india/13.jpg","photos/india/14.jpg","photos/india/15.jpg","photos/india/16.jpg","photos/india/17.jpg","photos/india/18.jpg","photos/india/19.jpg","photos/india/20.jpg","photos/india/21.jpg","photos/india/22.jpg");
var francearray = new Array("photos/france/1.jpg","photos/france/2.jpg");
var russiaarray = new Array("photos/russia/1.jpg","photos/russia/2.jpg","photos/russia/3.jpg","photos/russia/4.jpg","photos/russia/5.jpg","photos/russia/6.jpg","photos/russia/7.jpg","photos/russia/8.jpg","photos/russia/9.jpg","photos/russia/10.jpg","photos/russia/11.jpg","photos/russia/12.jpg","photos/russia/13.jpg");
function changeImageright()
{
if(i<21)
{
i++;
document.images["image"].src = indiaarray[i];
}
if(i==21)
{
i=0;
}
}
function changeImageleft()
{
if(i>0)
{
i--;
document.images["image"].src = indiaarray[i];
}
if(i==0)
{
i=21;
}
}
</script>
my photography.html is basically just:
<div style="float:left; width: 90px;">
<div class="navboxphoto">
<ul class="navphoto">
<li>
<div style="font-size:14px;"><a id="india" href="javascript:ajaxpage('india.html', 'photoarea');">India</a></div>
</li>
<li>
<div style="font-size:14px;"><a id="france" href="javascript:ajaxpage('france.html', 'photoarea');">France</a></div>
</li>
<li>
<div style="font-size:14px;"><a id="russia" href="javascript:ajaxpage('russia.html', 'photoarea');">Russia</a></div>
</li>
</ul>
</div>
</div>
at the moment, whether one clicks on anyone of the countries and click the forward or back button it goes through the indiaarray. I am looking for a way to test if the user clicks on india/france/Russia and then go through the applicable array.
I have tried booleans and everything, but do not know how to access a id from another html file or get the users choice...
Thank you very much in advance.
I use jquery to insert a separate HTML file in a div, when clicked, and then in that again a separate HTML file when a link is clicked on that file.
So I have my homepage > index.html. then photography.html and then india.html and one for each country.
www.anetnepgen.co.za/test.html is what i have done sofar.
ok, so my code.
in my index.html file I have a forward and back button.
<div class="leftColumn">
<a onClick="changeImageright()" id="changeRight" style="color:#FFF;"><img src="forward.png" /></a>
<a onClick="changeImageleft()" id="changeLeft" style="color:#FFF;"><img src="backward.png" /></a>
</div>
It is handled by:
<script type="text/javascript">
var i=0;
var indiaarray = new Array("photos/india/1.jpg","photos/india/2.jpg","photos/india/3.jpg","photos/india/4.jpg","photos/india/5.jpg","photos/india/6.jpg","photos/india/7.jpg","photos/india/8.jpg","photos/india/9.jpg","photos/india/10.jpg","photos/india/11.jpg","photos/india/12.jpg","photos/india/13.jpg","photos/india/14.jpg","photos/india/15.jpg","photos/india/16.jpg","photos/india/17.jpg","photos/india/18.jpg","photos/india/19.jpg","photos/india/20.jpg","photos/india/21.jpg","photos/india/22.jpg");
var francearray = new Array("photos/france/1.jpg","photos/france/2.jpg");
var russiaarray = new Array("photos/russia/1.jpg","photos/russia/2.jpg","photos/russia/3.jpg","photos/russia/4.jpg","photos/russia/5.jpg","photos/russia/6.jpg","photos/russia/7.jpg","photos/russia/8.jpg","photos/russia/9.jpg","photos/russia/10.jpg","photos/russia/11.jpg","photos/russia/12.jpg","photos/russia/13.jpg");
function changeImageright()
{
if(i<21)
{
i++;
document.images["image"].src = indiaarray[i];
}
if(i==21)
{
i=0;
}
}
function changeImageleft()
{
if(i>0)
{
i--;
document.images["image"].src = indiaarray[i];
}
if(i==0)
{
i=21;
}
}
</script>
my photography.html is basically just:
<div style="float:left; width: 90px;">
<div class="navboxphoto">
<ul class="navphoto">
<li>
<div style="font-size:14px;"><a id="india" href="javascript:ajaxpage('india.html', 'photoarea');">India</a></div>
</li>
<li>
<div style="font-size:14px;"><a id="france" href="javascript:ajaxpage('france.html', 'photoarea');">France</a></div>
</li>
<li>
<div style="font-size:14px;"><a id="russia" href="javascript:ajaxpage('russia.html', 'photoarea');">Russia</a></div>
</li>
</ul>
</div>
</div>
at the moment, whether one clicks on anyone of the countries and click the forward or back button it goes through the indiaarray. I am looking for a way to test if the user clicks on india/france/Russia and then go through the applicable array.
I have tried booleans and everything, but do not know how to access a id from another html file or get the users choice...
Thank you very much in advance.