I want two separate objects on a page to be moveable by the user - mouse click and drag. I’m having all sorts of problems achieving this. the following test code baffles me. Both objects get moved and I cannot work out why.
As @rpg_digital said above your code is very old and unlikely to work cross browser as you have a very old doctype and are utilising quirks mode. That means that certain things will only work if the browser steps in and helps you along with them.
The percentage height on your divs won’t work in standards mode in the way that you have defined them and the js won’t update because you have not used units on your measurements (px).
You don’t really want to leave anything to chance so choose a current doctype (html5) and make sure you use units in your dimensions for css measurements.
i.e. turn the number into a string with units by appending + “px”.
Works fine now Gandalf spotted the spelling mistakes so I didn’t close my divs
px is really not required - never has been and I’ve been writing html since before it was invented! Yes, it’s in fact IBM-s dsoss we used to use for documentation - html has one extra tag
Thanks but what you wrote is furthermore irrelevant to the problem!
No typos by the way - they may not make sense to you but they do to me - and not part of the problem - what are you a nit-picker?
Members are giving their up their free time to help, and are offering that help based on their understanding of the issue. If they don’t have the full picture, that is not their fault, nor is it a reason to respond with insults.
By all means disagree, but please do it courteously.
Sorry if my comments upset you but just trying to point you in the correct way of doing things these days. You may indeed have a unique set up that allows you to use old fashioned code but of course we were not aware of that situation.
It would indeed be remiss of us not to mention code that is broken or malformed as the Internet is forever and anyone else looking at this thread may copy your code and try to use it and fail miserably as it certainly will not work in a standards doctype. Now that you have explained you have a special situation and are able to use old fashioned code then visitors here can be aware that the code is a special use case only.