hi,
basically i have two html pages. on one page i have links that all point to the other page that pass an extra bit of information:
<a href="agencies.html#Agent1">1</a>
<a href="agencies.html#Agent2">2</a>
<a href="agencies.html#Agent3">3</a>etc...
on the other page i have this code to grab the infomation after the '#' charecter:
var loc=document.location.href;
var agency;
agency=loc.substring(loc.indexOf("#")+1,loc.length);
So basically the variable 'agency' holds a string; 'Agent1' or 'Agent2' or 'Agent3' etc...
i also have functions called Agent1(),Agent2(),Agent3()etc. that set information into div boxes throughout my web page.
here is an example of on of the agent functions:
function Agent1(){
document.getElementById('Div1').innerHTML='Info..';
document.getElementById('Div2').innerHTML='Info..';
document.getElementById('Div3').innerHTML='Info..';
}
in the body the divs are like this:
<div id="Div1"></div>
<div id="Div2"></div>
<div id="Div3"></div>
How can i, depending on what link i clicked call the particular function to set the correct agent information needed?
i.e. if i click the link:
<a href="agencies.html#Agent1">1</a>
it will call function:
function Agent1(){
document.getElementById('Div1').innerHTML='Info..';
document.getElementById('Div2').innerHTML='Info..';
document.getElementById('Div3').innerHTML='Info..';
}
i hope that this makes sense and i have made myself clear!!! thanks to anyone who can help me! im sure its something really easy but its just that i dont know!
thanks
-dan
basically i have two html pages. on one page i have links that all point to the other page that pass an extra bit of information:
<a href="agencies.html#Agent1">1</a>
<a href="agencies.html#Agent2">2</a>
<a href="agencies.html#Agent3">3</a>etc...
on the other page i have this code to grab the infomation after the '#' charecter:
var loc=document.location.href;
var agency;
agency=loc.substring(loc.indexOf("#")+1,loc.length);
So basically the variable 'agency' holds a string; 'Agent1' or 'Agent2' or 'Agent3' etc...
i also have functions called Agent1(),Agent2(),Agent3()etc. that set information into div boxes throughout my web page.
here is an example of on of the agent functions:
function Agent1(){
document.getElementById('Div1').innerHTML='Info..';
document.getElementById('Div2').innerHTML='Info..';
document.getElementById('Div3').innerHTML='Info..';
}
in the body the divs are like this:
<div id="Div1"></div>
<div id="Div2"></div>
<div id="Div3"></div>
How can i, depending on what link i clicked call the particular function to set the correct agent information needed?
i.e. if i click the link:
<a href="agencies.html#Agent1">1</a>
it will call function:
function Agent1(){
document.getElementById('Div1').innerHTML='Info..';
document.getElementById('Div2').innerHTML='Info..';
document.getElementById('Div3').innerHTML='Info..';
}
i hope that this makes sense and i have made myself clear!!! thanks to anyone who can help me! im sure its something really easy but its just that i dont know!
-dan