Just as many developers using PHP like to use the var_dump() functionality to find what exactly is happening with a variable many developers when using Javascript like to use the alert() function which can easily popup and crystalise what's going wrong with a variable. The problem with FBJS (FaceBook JavaScript) is that this functionality from javascript is non-existant, so I decided to create an alternative.
1 |
function alert(title, message, button) { |
As you can see it takes more parameters than your average alert function which is default with Javascript, however, if this is more than you require you can use this next snippet to just have the simple alert("message"); syntax.
1 |
function alert(message) { |
That's it, it is unfortunate Facebook didn't think to include something else to replace the alert() function within FBJS but using this may give you what outcome you need. Another thing, the message will support html output as an added bonus.
Anonymous
Posted at 2011-01-23 23:26:03
Why not combine both snippets?
function alert(message,heading,button){
title = (!heading) ? "Alert" : heading;
bttn = (!button) ? "OK" : button;
new Dialog().showMessage(title,message,bttn);
return false;
}
;-)
Anonymous
Posted at 2011-03-28 19:32:24
It saved me much time in searching. :-)
Reply to comment