javascript一点特殊用法
人气:0
,可以交换如:
<script type="text/javascript">
/*function update()
{
var name = dwr.util.getValue("demoName");
Demo.sayHello(name, function(data){
dwr.util.setValue("demoReply", data);
dwr.util.setValue("demoReply2",data);
});
}*/
/*
function setData(data)
{
dwr.util.setValue("demoReply", data);
dwr.util.setValue("demoReply2",data);
}
function update()
{
var name = dwr.util.getValue("demoName");
Demo.sayHello(name,setData);
}
*/
function update()
{
var name = dwr.util.getValue("demoName");
var name2 = $("demoName").value;
var name3 = document.getElementById("demoName").value;
alert(name2+name3+name);
Demo.sayHello(name,{
callback:function(data)
{
dwr.util.setValue("demoReply",data);
dwr.util.setValue("demoReply2",data);
}
});
}
hot = function hot(){ alert("Sweat.");}
cold = function cold(){ alert("Shiver.");}
function swap()
{
temp = hot;
hot = cold;
cold = temp;
alert("Swap.");
}
</script>
两个函数可以交换,就像普通变量一样。
<script type="text/javascript">
/*function update()
{
var name = dwr.util.getValue("demoName");
Demo.sayHello(name, function(data){
dwr.util.setValue("demoReply", data);
dwr.util.setValue("demoReply2",data);
});
}*/
/*
function setData(data)
{
dwr.util.setValue("demoReply", data);
dwr.util.setValue("demoReply2",data);
}
function update()
{
var name = dwr.util.getValue("demoName");
Demo.sayHello(name,setData);
}
*/
function update()
{
var name = dwr.util.getValue("demoName");
var name2 = $("demoName").value;
var name3 = document.getElementById("demoName").value;
alert(name2+name3+name);
Demo.sayHello(name,{
callback:function(data)
{
dwr.util.setValue("demoReply",data);
dwr.util.setValue("demoReply2",data);
}
});
}
hot = function hot(){ alert("Sweat.");}
cold = function cold(){ alert("Shiver.");}
function swap()
{
temp = hot;
hot = cold;
cold = temp;
alert("Swap.");
}
</script>
两个函数可以交换,就像普通变量一样。
加载全部内容