two way:
1) control different divs' display attribute
<script>
var g_pre_id = null;
function show(idstr)
{
var now_id = document.getElementById(idstr);
if(now_id) {
if(g_pre_id) g_pre_id.style.display = "none";
now_id.style.display = "";
g_pre_id = now_id;
}
}
</script>
<a href="javascript:show('para1')">我的图片</a>
<a href="javascript:show('para2')">我的图片 Else</a>
<div id="para1" style="display:none">
something....
</div>
<div id="para2" style="display:none">
something else ....
</div>2) change one div's innerHTML
<script>
function show(textsn)
{
var now_id = document.getElementById("para");
if(now_id) {
switch(textsn) {
case "p1text":
now_id.innerHTML = "something";
break;
case "p2text":
now_id.innerHTML = "something else ";
break;
}
}
}
</script>
<a href="javascript:show('p1text')">我的图片</a>
<a href="javascript:show('p2text')">我的图片 Else</a>
<div id="para">
something....
</div>
1) control different divs' display attribute
<script>
var g_pre_id = null;
function show(idstr)
{
var now_id = document.getElementById(idstr);
if(now_id) {
if(g_pre_id) g_pre_id.style.display = "none";
now_id.style.display = "";
g_pre_id = now_id;
}
}
</script>
<a href="javascript:show('para1')">我的图片</a>
<a href="javascript:show('para2')">我的图片 Else</a>
<div id="para1" style="display:none">
something....
</div>
<div id="para2" style="display:none">
something else ....
</div>2) change one div's innerHTML
<script>
function show(textsn)
{
var now_id = document.getElementById("para");
if(now_id) {
switch(textsn) {
case "p1text":
now_id.innerHTML = "something";
break;
case "p2text":
now_id.innerHTML = "something else ";
break;
}
}
}
</script>
<a href="javascript:show('p1text')">我的图片</a>
<a href="javascript:show('p2text')">我的图片 Else</a>
<div id="para">
something....
</div>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货