[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-13-2005, 12:34 PM   #1 (permalink)
NamePros Regular
 
gamex's Avatar
 
Join Date: Feb 2004
Location: Student @ UConn
Posts: 408
73.95 NP$ (Donate)

gamex has a spectacular aura aboutgamex has a spectacular aura about


Need some help with Javascript

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!
__________________
Joe
CarrotCash.com
gamex is offline  
Old 12-13-2005, 01:11 PM   #2 (permalink)
NamePros Member
 
tzmartin's Avatar
 
Join Date: Dec 2005
Location: Missouri
Posts: 92
8.00 NP$ (Donate)

tzmartin is an unknown quantity at this point


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.
tzmartin is offline  
Old 12-13-2005, 01:29 PM   #3 (permalink)
NamePros Regular
 
sjaguar13's Avatar
 
Join Date: Nov 2005
Posts: 382
7.75 NP$ (Donate)

sjaguar13 has a spectacular aura aboutsjaguar13 has a spectacular aura about


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>
__________________
Tiny Atoms | Nonny's | VX8800.com
sjaguar13 is offline  
Old 12-13-2005, 07:04 PM   #4 (permalink)
NamePros Regular
 
gamex's Avatar
 
Join Date: Feb 2004
Location: Student @ UConn
Posts: 408
73.95 NP$ (Donate)

gamex has a spectacular aura aboutgamex has a spectacular aura about


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
__________________
Joe
CarrotCash.com
gamex is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
*Urgent* Javascript problem, 45 NP$ to fix. mholt Programming 18 11-28-2005 02:09 PM
Javascript / PHP Question Zubair1 Programming 4 08-20-2005 08:55 AM
JavaScript Programs... Richieboy67 CODE 3 03-28-2005 11:03 AM
JavaScript Jamison54 Website Development 3 01-30-2005 07:37 PM
How I fill javascript array with php variables? wiedzim CODE 0 03-31-2004 02:45 AM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 03:36 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85