By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,259 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,259 IT Pros & Developers. It's quick & easy.

window.event syntax error...

P: 5
Hi everybody,

I am new in javascript. I am working on resizing a control like Image by dragging it to a desired size at runtime. Now, my onmouseover event is working ok where the cursor type is change when position on particular part of control. But the function being called by my onmousedown event has error telling me a syntax error on line 90 (mouseDragImage). What is wrong with it? Thanks in advance.

den2005

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. function mouseOverImage()
  4.         {
  5. //            var ev = window.event;
  6.             ev = window.event;
  7.  
  8.             var x;
  9.             var y;
  10.  
  11.             if(ev.pageX || ev.pageY){
  12.                 alert(ev.pageX + ", " + ev.pageY);
  13.                 x = ev.pageX;
  14.                 y = ev.pageY;
  15.             }
  16.             else
  17.             {
  18.                 x = ev.clientX + document.body.scrollLeft - document.body.clientLeft;
  19.                 y = ev.clientY + document.body.scrollTop  - document.body.clientTop;
  20.             }
  21.  
  22.             var wd = document.getElementById('Img3').offsetWidth;
  23.             var ht = document.getElementById('Img3').offsetHeight;
  24.  
  25.             var ctrlx = document.getElementById('Img3').offsetLeft;
  26.             var ctrly = document.getElementById('Img3').offsetTop;
  27.    . . . ..  ..  .
  28.  }
  29.  
  30.  
  31. function mouseDragImage()
  32.          {
  33.             var cursor = document.getElementById('Img3').style.cursor;
  34.             var ev = window.event;
  35. //            var ev = event;
  36.  
  37.             var newX = 0;
  38.             var newY = 0;
  39. //            var ox = 0;
  40. //            var oy = 0;
  41.  
  42. //            alert(cursor);
  43. Line 90 -->if(ev.pageX || ev.pageY){
  44.                 if (ox = 0 && oy = 0)
  45.                 {
  46.                     ox = ev.pageX;
  47.                     oy = ev.pageY;
  48.                 }
  49.                 else
  50.                 {
  51.                     newx = ev.pageX;
  52.                     newy = ev.pageY;
  53.                 }
  54.             }
  55.             else
  56.             {
  57.                 if (ox = 0 && oy = 0)
  58.                 {
  59.                     ox = ev.clientX + document.body.scrollLeft - document.body.clientLeft;
  60.                     oy = ev.clientY + document.body.scrollTop  - document.body.clientTop;
  61.                 }
  62.                 else
  63.                 {
  64.                     newx = ev.clientX + document.body.scrollLeft - document.body.clientLeft;
  65.                     newy = ev.clientY + document.body.scrollTop  - document.body.clientTop;
  66.                 }
  67.             }
  68.       ........
  69.     }
  70.  
Jul 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: 5
I have solve the syntax error...Now making resizing at runtime work...

den2005
Jul 12 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.