home *** CD-ROM | disk | FTP | other *** search
/ Inside Dreamweaver 4 / IDW4.ISO / pc / Projects / ch22 / Exercise_Files / Exercise_11 / Resize.js < prev   
Encoding:
Text File  |  2001-01-23  |  876 b   |  35 lines

  1. function resizeBrowserWindow(width,height) {
  2.     window.resizeTo(width,height); 
  3. }
  4. function behaviorFunction() {
  5.     return "resizeBrowserWindow"; 
  6. }
  7.  
  8. function canAcceptBehavior() {
  9. return ("onMouseUp");
  10. }
  11.  
  12. function applyBehavior() { 
  13.     var width=document.theForm.width.value;
  14.     var height=document.theForm.height.value;
  15.     if (width=="" || width<1 || width>2000 || parseInt(width) != width) {
  16.         width=300;
  17.         }
  18.     if (height=="" || height<1 || height>2000 || parseInt(height) != height) {
  19.         height=300;
  20.         }
  21.     return "resizeBrowserWindow(" + width + "," + height + ")";
  22. }
  23.  
  24. function inspectBehavior(ResizeFunctionCall) {
  25.   var argArray = new Array;
  26.   argArray = extractArgs(ResizeFunctionCall);
  27.   document.theForm.width.value = argArray[1];
  28.   document.theForm.height.value = argArray[2];
  29.  
  30. function initializeUI() {
  31.   document.theForm.width.focus(); 
  32.   document.theForm.width.select(); 
  33. }
  34.