Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-20-2008, 05:42 PM   PM User | #1
Remotive
New Coder

 
Join Date: Jan 2008
Posts: 30
Thanks: 1
Thanked 0 Times in 0 Posts
Remotive is an unknown quantity at this point
Scriptaculous - Saving a positions co-ordinates?

Just wondering this, but say I had a image in scriptaculous and I dragged it around etc. If I pressed save, meaning it would grab the information for the x and y co-ordinates using "document.getElementById('DIVNAME').style.left;" and "document.getElementById('DIVNAME').style.top;" and sent the information to a database, would the getElementById work?

As in, every time I moved the image would it update the style.top and style.left of the image and send it to the database?

If you don't understand I may be able to explain it more, hopefully. :P
Remotive is offline   Reply With Quote
Old 05-20-2008, 10:12 PM   PM User | #2
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
Yes, that would work. The values for 'left' and 'top' won't necessarily be relative to the browser though, so depending on how you're reusing them it could cause problems. If you're going to be setting the values in the same HTML layout it will be fine, but otherwise you might want to use Prototype's getCumulativeOffset instead.

As a tip, if you're using Scriptaculous anyway, then Prototype's $() method is available to you, to save having to type document.getElementById so often.
__________________
My thoughts on some things: http://codemeetsmusic.com
And my scrapbook of cool things: http://gjones.tumblr.com
GJay is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:21 PM.


Advertisement
Log in to turn off these ads.