| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | 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! |
| |
| | #2 (permalink) |
| NamePros Member | 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. |
| |
| | #3 (permalink) |
| NamePros Regular | 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;
}
|
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
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 |