js/css在ajax UpdatePanel 中没有效果的解决方法
js没效果:如果在以UpdatePanel的方式的局部回传中,普通的Javascript代码在这种局部回传中就不会在触发了,就必须使用scriptmanager.RegisterClientScript方法(在<form>后面注册<script>)和scriptmanager.RegisterStartupScript方法(在</form之前注册<script>)
在你的用户控件的后端的某个合适位置,采用合适的注册方法,比如说load事件可以写以下代码:
//你的javascript代码
string script="var a='helloworld';alert(a);";
this.page.scriptmanager.RegisterStartupScript(this.page,typeof(string),"scriptforusercontrol",script,true);
css没效果:
string s = @"<LINK href="Css/Styles5.css" type="text/css" rel="stylesheet">";
ClientScript.RegisterStartupScript(this.GetType(), "", s);
这样就可以了。
相关文档:
In this specification, the expression collapsing margins means that adjoining margins (no non-empty content, padding or border areas or clearance separate them) of two or more boxes (which may be next to one another or nested) combine to form a single margin.
In CSS 2.1, horizontal margins ne ......
IE和火狐的css兼容性问题归总
CSS对浏览器器的兼容性具有很高的价值,通常情况下IE和Firefox存在很大的解析差异,这里介绍一下兼容要点。
1、DOCTYPE 影响 CSS 处理
2、FF: div 设置 margin-left, margin-right 为 auto 时已经居中, IE 不行
3、FF: body 设置 text-align 时, div 需要设置 margin: aut ......
一 css的优先级
今天有人跟我说css
hack中用!important来区分ie6,因为ie6不支持!important,是的在很早以前我也是用过这种方法写hack,但是后来就基本不用了。本来我对他谁的ie6不支持!important也没什么异议,可是正好在前几天正好用个这个!important属性解决了一个样式优先级的问题,而且是支持ie6的,这是为什么呢? ......
function CreateXmlHttp()
{
if(window.ActiveXObject)
{
try
{
XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){};
try
{
XmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){};
}
else if(window.XMLHt ......
<
script language=
"javascript"
>
$(
document)
.ready
(
function
(
)
{
$(
'#send_ajax'
)
.click
(
function
(
)
{
var
params=
$(
'input'
)
.serialize
(
)
;
//序列化表单的值
$.ajax
(
{
url:
'ajax_json.php'
,
//后台处 ......