|
a simple onloading prob. -- WangE --
I just don't quite understand the following javascript codes: MyAjax.dataset.onLoading=function(b) { var e=document.getElementById("loadingInfo"); e.style.visibility=b?"visible":"hidden"; } Well,what does the parameter "b" mean?where does it come from,and stands for what? It seems this simple sentence works quite good,how does it work?does it check the status (of "b") at intervals? Thanks for help! -- -------Wang E-------- (Well,gmail doesn't support html style signature,that's disappointing.) |
|
-- AlbertWeinert --
WangE schrieb: I just don't quite understand the following javascript codes: MyAjax.dataset.onLoading=function(b) { var e=document.getElementById("loadingInfo"); e.style.visibility=b?"visible":"hidden"; } Well,what does the parameter "b" mean?where does it come from,and stands for what? The "b" stand for showing, it's a boolean with true or false. You can also give them a better name. If you get a true you should show your loading info and with false you should hide it. MyAjax.dataset.onLoading=function(show) { var e=document.getElementById("loadingInfo"); e.style.visibility=show?"visible":"hidden"; } It seems this simple sentence works quite good,how does it work?does it check the status (of "b") at intervals? It would be called by the Ajax.NET Pro at the beginning of an async-request and at the end of that request. Mostly the element is hiding after your callback-faunction. It would not be called by sync-request, better it makes even no sense, because the browser would not update the page. -- Freundliche Grüße Albert Weinert http://der-albert.com |
|
-- Zihotki --
b?"visible":"hidden" - this is a sample of trinar operator. It's equal with this: if (b) { e.style.visibility="visible"; } else { e.style.visibility="hidden"; } |