,可以交換如:
<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>
兩個函數可以交換,就像普通變數一樣。