Forum Moderators: open
<head>
<script type="text/javascript">
function show() {
document.write("<table><tr>")
document.write("<td><div align='center'><a href='images/..../pic1.jpg'><img src='images/..../pic1_t.jpg'></a></div></td>")
document.write("</tr></table">)
document.write(<p></p>)
}
</head>
<body>
<form>
<input type="button" onclick="show()" value="Pictures">
</form>
</body>
<script type="text/javascript">
var contents = '<a href="images/..../pic1.jpg"><img src="images/..../pic1_t.jpg"></a>';
function showPics() {
document.getElementById('hereplease').innerHTML = contents;
}
</script>
...
<a href="#" onclick="showPics(); return false">pictures please</a>
...
<div id="hereplease" align="center"></div>
This should work in IE5 and up as well as in the more recent versions of Mozilla/Netscape and Opera. Hope this answers your question.
<html>
<head>
<title>Test2</title>
<script type="text/javascript">
var hide = '<a href="#" onclick="hidepic(); return false">Hide Picture</a><div id="hidethis"></div><img src="image.jpg">';
var show = '<a href="#" onclick="showpic(); return false">Show Picture</a><div id="hidethis"></div>';
function hidepic() {
document.getElementById('hidethis').innerHTML = show;
}
function showpic() {
document.getElementById('showthis').innerHTML = hide;
</script>
<body>
<a href="#" onclick="showpic(); return false">Show Picture</a>
<div id="showthis"></div>
</body>
</html>
<html>
<head>
<title>Test</title>
<script type="text/javascript">
var lay1=0
var lay2=0
function layer1() {
lay2=0
if (lay1%2==0) {
document.getElementById("L1").style.display="block" }
else {
document.getElementById("L1").style.display="none" }
document.getElementById("L2").style.display="none"
lay1++
}
function layer2() {
lay1=0
document.getElementById("L1").style.display="none"
if (lay2%2==0) {
document.getElementById("L2").style.display="block" }
else {
document.getElementById("L2").style.display="none" }
lay2++
}
</script>
<body>
<a href="#" onclick="layer1(); return false">Layer1</a>
<div id="L1" style="display:none">
<img src="image1.jpg">
</div>
<a href="#" onclick="layer2(); return false">Layer2</a>
<div id="L2" style="display:none">
<img src="image2.jpg">
</div>
</body>
</html>