javascript一点特殊用法
时间:2021-07-01 10:21:17
帮助过:9人阅读
,可以交换如:
<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>
两个函数可以交换,就像普通变量一样。