如下的效果,初始显示一段内容,点击+显示另一段内容,点击-回到初始内容,可是现在有问题,一旦后显示的内容里有图片,那么就报错,图片缩放效果失效。无忧问到蓝色到CSDN,CSDN上算有个高人知道说当img的style为DISPLAY: none的时候就无法得到height,所以报错,图片无法缩放了,但是要使图片一开始不出现又必须使用DISPLAY: none,但是没人给解决了这个问题,那么这是不是互相矛盾的?是无解的吗?这种效果是无法实现的?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>123</title>
</head><body>
<IMG id=Close_img onClick="this.style.display='none'; Close_text.style.display='none'; Open_img.style.display='inline'; Open_text.style.display='inline';"  alt="点击查看全文" src="http://bbs.dvbbs.net/skins/style_60/plus.gif" width=11 height=11 align=top><!--点击打开文章的图片-->
<IMG id=Open_img style="DISPLAY: none" onClick="this.style.display='none'; Open_text.style.display='none'; Close_img.style.display='inline'; Close_text.style.display='inline';"  alt="点击关闭全文" src="http://bbs.dvbbs.net/Skins/Default/nofollow.gif" width=11 height=11 align=top>
<SPAN id=Close_text >
可以正常缩放图片<br />
<img src="http://www.ali213.net/picfile/News/200909/ps_3.jpg" onload='javascript:if(this.width>200)this.style.width="200px";this.style.height=this.height*(200/this.width)+"px";' />
</SPAN>
<SPAN id=Open_text style="DISPLAY: none">
语句未变,无法正常缩放图片,IE6、8下测试均报错,参数无效<br />
<img src="http://www.ali213.net/picfile/News/200909/ps_3.jpg" onload='javascript:if(this.width>200)this.style.width="200px";this.style.height=this.height*(200/this.width)+"px";' />
</SPAN></body>
</html>