Name.com Cyber Monday sale: $6.99 .com domains and more. Shop the sale.

Need some help with Javascript

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

gamex

Established Member
Impact
7
Hey guys,

I know PHP, HTML, and CSS, but never really got into javascript, so I need some help.

I have a javascript I found, which you can see here:

http://www.gameworldx.com/aboutblank/demo.html

It allows you to drag and drop images and text and things like that all over the screen. I was wondering if there was a way to click a submit button at the bottom and then have the positions saved to a database. I know how to save and everything, I just dont know if its possible to save the coordinates into a hidden field and then submit them.

Thanks!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You can save the coordinates for each user by putting the data in a cookie, or a variable. BTW, your demo page doesn't work for me. I'm using FF 1.5.

DynAPI provides an example of saving cordinates using cookies. This example shows how to display coordinates. With some extra coding you could then put the coordinates into a variable and save client side (cookie) or dynamically save the variable to a database,via xmlHTTPRequest, without refreshing the page. To see a full implementation of Drag and Drop with AJAX style programming, check out Protopage.
 
0
Close
It doesn't work for me either in Firefox, but it does in IE.


You have a get x and y function, so you could do something like:

Code:
function submitPosition() {
	   var layPos = "";
         for(var layer = 0; layer < Layers.length; layer++)
            {                       
			layPos = layPos + "Layer" + layer + "x=" + GetX(Layers[layer].id) + "&";
			layPos = layPos + "Layer" + layer + "y=" + GetY(Layers[layer].id) + "&";
            }

	    document.location = "http://www.YourSite.com/PositionScript.php?" + layPos;
}

That would then send the variables Layer0x, Layer0y, ect to your script. You could create a link to call that function, <a href="javascript:submitPos();">Submit Positions</a>
 
0
Close
Well I guess since 2 out of 2 people who tested it had problems, I wont be using this script. But thanks for the info, I will try using that info on a similar script which hopefully will be a bit more compatible
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back