Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good Afternoon

Code that should change y when function called

function ynof()
{
what.y+=40;
}


was run from console did not move what

is any other way

What I have tried:

javascript functions object research
Posted
Updated 10-Sep-21 5:08am
Comments
Richard Deeming 10-Sep-21 10:08am    
There's a secret error somewhere in your secret code. You need to fix that.

Seriously, look at your question again, remembering that we cannot see your screen, access your computer, or read your mind. How do you expect anyone to be able to help you based on the complete lack of information provided?

Click the green "Improve question" link and update your question to include the relevant parts of your code - for example, where the what variable is declared, how the ynof function is called, etc.

1 solution

All that does is increment a property on an object. Were you expecting it to do more?
 
Share this answer
 
Comments
four systems 10-Sep-21 12:23pm    
y is y co ordinate so when function is called what which is dom element should go where y is 40

earlier thought what.y=40;

but then changed what.y+=40;
Member 15329613 10-Sep-21 14:05pm    
No, there must be more to it. To change coordinates in javascript you set object.style.left or object.style.top for example. You can't just call object.y. So you have other code somewhere that no one else can see that makes the object actually move.

You aren't sharing enough for anyone to help you.
four systems 10-Sep-21 23:24pm    
that is the code The thought being get objectdotycoordinate and change it
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900