Prev | Current Page 270 | Next

Frank Zammetti

"Practical DWR 2 Projects"


appConfigured This is set during initialization, and it is used later on when a determination
about the app being configured or not is required in the JavaScript.
Next up we see two functions that handle our mouse events for our buttons on the top
and side:
// onMouseOver handler for buttons.
function btnMouseOver(obj) {
id = obj.id;
obj.src = eval("img_" + id + "_over").src;
obj.style.cursor = "pointer";
}
CHAPTER 4 n INSTAMAIL: AN AJAX-BASED WEBMAIL CLIENT 142
// onMouseOut handler for buttons.
function btnMouseOut(obj) {
id = obj.id;
obj.src = eval("img_" + id).src;
obj.style.cursor = "";
}
This is pretty typical mouse rollover code. We get the ID of the object that called the
method, one of the buttons, and then use the eval() function to get a reference to the appropriate
preloaded image. We then set the src of the button to the src of the preloaded image,
completing the rollover (or rollout, as it were). In addition, the cursor style attribute is
changed so that we get a pointer when we hover over a button.
Make the Mouse Do Pretty Things
After that are two similar functions for dealing with rows in either the Inbox or Sent Messages
tables:
// onMouseOver handler for rows in Inbox or Sent Messages.


Pages:
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282