我先说明一下,下面这段代码的功能,主要是客户端根据 服务器端 this.ImageStyle 的值,生成同名但作用不同的 CSS 样式:
<style>
<% if(this.ImageStyle=="right")
{ %>
.MutiImageSmallContainer{margin-top:5px;width:160px;height:200px;}
<% }
else
{ %>
.MutiImageSmallContainer{margin-top:5px;}
<% } %>
</style>
============================================================================
现在想请问:如果作出修改,以达到不需要在服务器端对 this.ImageStyle 进行修改就可以对 .MutiImageSmallContainer 这个样式进行变换呢? 谢谢~~~
<style>
<% if(this.ImageStyle=="right")
{ %>
.MutiImageSmallContainer{margin-top:5px;width:160px;height:200px;}
<% }
else
{ %>
.MutiImageSmallContainer{margin-top:5px;}
<% } %>
</style>
============================================================================
现在想请问:如果作出修改,以达到不需要在服务器端对 this.ImageStyle 进行修改就可以对 .MutiImageSmallContainer 这个样式进行变换呢? 谢谢~~~
可以说得详细点吗? 谢谢...
<html>
<body>
<form>
<tr>
<td height='<%=strHeight %>' />
</tr>
</form>
</body>
</html>
在后台中可以定义:
public string strHeigh;
这个时候你可以对strHeigh可以随意发附值啊,可以从数据库中取值,也可以取页面输入的值!
希望我所说的对你有所启示!
<head>
<script>
function css(cs)
{img01.className=cs;
}
</script>
<style>
<!--
.aa { margin-top:5px;width:160px;height:200px;}
.bb { margin-top:5px;}
-->
</style>
</head>
<body>
<img id=img01 src="">
<input type="submit" name="Submit" value="aa" onclick=css("aa")>
<input type="submit" name="Submit2" value="bb" onclick=css("bb")>
</body>
</html>