On Jun 3, 5:15*pm, shapper <mdmo...@gmail.comwrote:
Hello,
In a simple HTML page, index.html, I have:
- 3 anchors: A, B and C;
- 3 divs: dA, dB and dC;
Each anchor should load, when clicked, index.html but anchor A should
make dA visible and the other invisible, anchor B should show dB and
hide the others.
How can I do this?
Thanks,
Miguel
This was tested very quickly but works in IE 7.
It uses Javascript but you didn't specify a scripting language of
choice.
<code>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Dynamic Java Querystring</title>
</head>
<body>
<script type="text/javascript">
<!--
function querySt(param) {
var loc = window.location.search.substring(1);
var query = loc.split("&");
for (i=0;i<query.length;i++) {
var currParam = query[i].split("=");
if (currParam[0] == param) {
return currParam[1];
}
}
}
-->
</script>
<a href="test.htm?q=Da">A</a>
<a href="test.htm?q=Db">B</a>
<a href="test.htm?q=Dc">C</a>
<div id="Da" style="visibility: hidden;">
<p>Div A</p>
</div>
<div id="Db" style="visibility: hidden;">
<p>Div B</p>
</div>
<div id="Dc" style="visibility: hidden;">
<p>Div C</p>
</div>
<script type="text/javascript">
<!--
document.getElementById(querySt('q')).style.visibi lity = 'visible';
-->
</script>
</body>
</html>
</code>