There's an easy way to list properties or attributes here https://stackoverflow.com/questions/...-in-javascript
Found that style does not have undocumented properties x and y, but img does have x and y attributes. So why did img.style get empty x,y when they are image attributes?
You are right W, with does not work as I expected, in Chrome anyway! Cheers.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Reply to: Odd jscript problem
Collapse
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
- You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
- You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
- If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on "Odd jscript problem"
Collapse
-
I’m guessing from looking at it that you are passing an image style to the with command.
The with command changes the scope of variables. So it will look at any properties on the passed argument first.
So again guessing here cause I can’t debug, but I imagine theire are properties x and y on the passed argument style.x and style.y.
They may have been introduced on new versions etc.
All just guesses and may be why with is deprecated.
Leave a comment:
-
Cheers woohoo. Didn't know it was deprecated. Scripts are a few years old.
Doesn't explain why x,y are treated as style properties though, nothing in my jscript or html to account for it.
Fortunately, they all seem to be working again after just changing x,y to xx,yy.Last edited by xoggoth; 9 March 2018, 18:16.
Leave a comment:
-
with statement is deprecated.
but looking at the code, I'm assuming x and y are properties of the argument passed into the with statement "imgs[n].style".
Leave a comment:
-
Odd jscript problem
Just found some kid's games I did a few years ago don't work in Chrome or Opera anymore, although still ok in IE and Edge.
Narrowed it down to variables x,y being treated as style properties. This does not work as x, y have no values inside the with:
x = e.pageX - x0; y = e.pageY - y0;
with (imgs[n].style)
{if (x>=pos(left))
{blah blah
Whereas this is ok:
xx = e.pageX - x0; yy = e.pageY - y0;
with (imgs[n].style)
{if (xx>=pos(left))
{blah blah
Can't find anything in CSS style lists to suggest x is a style property. Gotta go through a whole lot of code and change x,y to summit else now. Is it usual for some browsers to invent their own properties and, if so, any lists? Ta.Last edited by xoggoth; 9 March 2018, 11:56.Tags: None
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Leave a comment: