I have a (seemingly) simple task. I would like to swap out the contents of a div using the onClick() function. I can also use php, if need be. Basically I'd like to mimic what Target.com has done
Here. The description features... tabs are very nice. it looks as though they are using a javascript function but I am not good enough to figure it out. Too new to js I guess. ANY help would be greatly appreciated.
This is what I have so far (the only code that has worked, even a little):
Code:
<script type="text/javascript">
function changeDesc(desc) {
var obj = document.getElementById("special");
var description = ("This is a detail");
var feature = ("These are the features");
obj.firstChild.nodeValue = description;
}
</script>
</head>
<body>
<a href="" onclick="changeDesc('feature'); return false;">Description</a>
<a href="" onclick="changeDesc(); return false;">Feature</a>
<div id="special">
Whatever is in here should change?
</div>
This frustrated musician thanks you in advance.