JQuery :: Reorder Images And Save The Order Into Database?
Jan 12, 2010
I know that there are some really nice jQuery UI. However, I'm really new to jQuery and I need to save the order into a SQL Server database so that next time if the same user comes back to the site, the picture will be in the same order that he/she reordered it previously.
View 1 Replies
ADVERTISEMENT
Apr 5, 2011
This is a combination of jQuery and a PHP problem so I'm not 100% certain where to post it. I am working on method to reoder a list that comes from a database. When the lists is displayed, it will be ordered by a "sort" column. The user can drag/drop the list to change the order, and I want the order to update the sort values in the database.I found a script that provides a decent starting point, but I am not getting the results I want.
1: It is able to reorder the columns, and save the results which is good.
2: It is saving the results as "0,1,2,3" rather than reordering the numbers from the "sort" column. (< this is what I need fixed)
EG: Name > Sort
Apple3
Orange 5
Pear 13
Kiwi 105
If I reorder these in the reverse order using the script, I end up with the following in the database.
Apple 3
Orange 2
Pear 1
Kiwi 0
Yet what I want is,
Apple 105
Orange 13
Pear 5
Kiwi 3
how I can get it to work with the existing "sort" values, rather than serializing and starting at 0. Here are the script files I am currently working with for testing.
DATABASE
Code:
CREATE TABLE `menu` (
`id` int(11) NOT NULL auto_increment,[code]....
View 1 Replies
View Related
Jun 22, 2010
Is there a way to save the scroll position in order to recover it when the page gets reloaded or resend from the server?
View 12 Replies
View Related
May 25, 2010
I am working on a small gadget which downloads a series of images from the web and displays the images in a loop. However i am having trouble saving the xmlhttprequest to a file to use later in an array. I have read that it should be easy to save the .png using Scripting.filesystemobject but have been unable to find any information on how to do it.
Here is my code so far:
Code:
View 1 Replies
View Related
Oct 1, 2010
Am looking to find the easiest way to populate an order form that customers can email through to us.
I have created a database with 2 fields, id and name.
I would like to be able to have a form on my page with 3 fields, id name and qty.
I want to link the id and name fields on my form to my database so that when a customer starts to type a product id or description it will show a list of available matches. underneath which once clicked will populate the mssing field.
So for example is i have 2 products id 998 green apples and 999 red apples.
Typing in 999 in the id field of the form would populate the name field with red apples and typing red apples in the name field would populate the id field with 99.
if someone didn't know which apples they wanted they could type apples in the name field and underneath it would show both red and green which when clicked will populate both fields.
View 1 Replies
View Related
Jun 22, 2010
I have a problem. I have a div component where I'll drag multiple images. This part is working perfectly. But I am not able to read the order of these images played in the component. What happens, I can play any position in the image of the div component, however, like to read in order as they are, from left to right.
I believe it is possible, but the solution must be complicated. Some of his friends could help me in the routine javascript to read this?
[Code]...
View 4 Replies
View Related
Sep 11, 2009
I am making a mini wysiwyg editor for creating pdf letters which can be printed off.
In my editor is currently a html form which saves the textarea values each time the form is submitted. I want it to save to the database everytime its changed or maybe every few seconds.
View 3 Replies
View Related
Aug 26, 2011
getting the selected radio button and save it in the database. Here is my code:
[Code]....
I wanted to know which answers are selected and save those answers in the database with the corresponding question. I am using MYSQL as my database tool. I know how to use MYSQL and querying but I just don't know how to get the datas that I need.
View 6 Replies
View Related
Jul 18, 2009
i have created text fields dynamically by clicking a button now problem is that i want to save the value of these text field into database. i m using java script with PHP's framework codeigniter. the code is as follows
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
[code]....
View 1 Replies
View Related
Jan 14, 2011
I want to grab images from the database and then display them in a row going downwards. I be using position absolute in css. I want to put them in a row going downwards but having the exact space inbetween each image. Currently I made a row of images going downwards but the space inbetween keeps on increasing when more and more images are needed to be displayed.
[Code]...
Yet the space inbetween images increases the space when there is more and more images displayed.
The first 3 are always have the right space inbetween them. The 4th and so on adds 10px of space more for each image that is displayed but it's gradually. For instance image 4 would be you would take 70 which is image 3 top value and instead of adding 30 the code would add 40 to it. it increases the spaces by 10 for every image past the 3rd image. Yet the firebug will show the top values as if each image has a difference of 30 for the top value.
I was thinking can't I use position X and Y like with jquery or javascript can't I get the current x and y values of image one or 2 and then decrease the X and Y in a way that the spaceing inbetween each image is exactly the same. In our example I want to have like a 30px space inbetween the images and never increase the space as more images are displayed.
View 1 Replies
View Related
Oct 25, 2010
i've being trying to change the src of a img tag in order to create some kind of a sequence of images.
Code:
<script type="text/javascript">
var i=0;
[code]....
View 6 Replies
View Related
Jan 2, 2011
I'm still a beginner to javaScript, but I'm trying to write a script for a simple image change using next and previous buttons. The following script works, except that the images do not rotate in the desired order. The script works as long as you don't switch from next to previous, which is when the wrong images are shown.
<html>
<head>
<title>Button Click 12</title>
<style type="text/css">
button {
font-family:georgia;
font-style:italic;
font-size:12px;
font-weight:bold;
cursorointer;
border:1px solid red;
background-color:aqua;
display:inline-block;
padding:2px 20px;
margin:0 5px;
} .....
View 1 Replies
View Related
May 18, 2011
I'm using the following script to show images with fade in and out. How can I display the images in random order?
Code:
View 1 Replies
View Related
Sep 7, 2009
I wish to give the user the ability to download a file. The variable "url" is set to the url of a file on the server. I want to give the user the ability to either open it (if known type) or save it.
The following works for documents such as MS Word, but not for images (jpg, etc):
window.open(url,'Download');
Any suggestions how to not just create a new window for images, but give the choice whether to save it or view it?
View 11 Replies
View Related
Dec 20, 2009
I have recently worked on a flash based learning course and built functionality where users throughout the course can type in their own notes based on the course, and they can revisit these everytime they launch the course, the functionality is simply using flash cookies to store the notes on the users machine. I wanted to build functionality so that they could then save these notes to their hard disk and e-mail them on. To do this I call a javascript function from flash which opens a new webpage, passes through the notes from flash and uses document.write to write the notes to the new webpage. Then the user Saves (as web page html only) to save a copy to their machine.
The problem is I want to do this web page up a bit more, add graphics etc. but if I save as web page html only it won't include any images I add to the html page, and if I change it so that they save as (Web Page Complete) rather than write the webpage out with the notes it will write the webpage with the code document.write(string) but as this is on the users hard disk now string will be undefined as it no longer run alongside the course. Is their any other way anyone can think of doing this type of functionality, I am trying to stay away from using PHP
View 1 Replies
View Related
Nov 24, 2010
Is there a best way to reorder a jquery group/array, eg bring one item to the first position? Should you do it with a normal array.sort() or splice(), or is it possible with an internal function map()?
View 2 Replies
View Related
Sep 22, 2006
I found this javascript to randomize an image on a page...
Code:
<script language="JavaScript" type="text/javascript">
<!--
function random_img(){
var ranimage = new Array();
ranimage[1] = "photo1.jpg";
ranimage[2] = "photo2.jpg";
ranimage[3] = "photo3.jpg";
var ry = Math.floor(Math.random()*ranimage.length)
if (ry==0)
ry=1
document.write('<img src="'+ranimage[ry]+'" border=1>');
}
random_img();
// -->
</script>
I have some images that are dynamically generated and i want these images to randomize every few seconds (at the moment the images change when the user goes to a different page on the site)...can anyone give me any ideas as to whether this is possible??
The PHP code i'm using is below...
<?php
// read image dir
$dir="../../admin/uploads/";
// Open directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (filetype($dir . $file)== "file"){
$counter++;
$selectSQL = "SELECT id, url, imagefile from images";
$result=mysql_query($selectSQL);
#print $result . " - " . mysql_error();
$nameStack=array();
$urlStack=array();
while ($row = mysql_fetch_assoc($result)){
$thisurl= $row['url'];
$thisid= $row['id'];
array_push($nameStack, $row['imagefile']);
array_push($urlStack, $row['url']);
}
}
}
closedir($dh);
}
}
// load each image into array echo rand(5, 15);
// get count of total no. of images
$lastNo=sizeof($urlStack)-1;
$imageToUse=rand(0,$lastNo);
#print "using image $imageToUse of $lastNo";
$imageName=$nameStack[$imageToUse];
$imageUrl=$urlStack[$imageToUse];
#print "got $imageUrl and $imageName
";
//
?>
<a href="<?php echo $imageUrl; ?>"><img src="http://mywebsite.com/admin/uploads/<?php echo $imageName; ?>" alt="click here for our special offers" border=0 /></a>
View 6 Replies
View Related
Dec 13, 2010
I have a PHP script that will get images out of the database and display them in a grid. I have two verisons. I save a thumbnail which I display and then a larger image in a different folder. These images are placed in a scroll bar but what I would like to happen is that when I click on a thumbnail it basically displays the bigger image until I click on that image and it goes away. I would love for the middle of the image to be displayed in the middle of the users screen but beggers probably can't be choosers in this case.
An example of a similar desired result is a link here:http://qrayg.com/experiment/hig/Instead of the hover, I'd like to utilize the onclick to display and remove the image. If it's easy to put the center in the center of the screen that that would be absolutely incredible as well.
View 8 Replies
View Related
Sep 15, 2009
I have a slideshow that gathers images from a database. I've been trying to set it up to where it extracts the IMG SRC accordingly so when I click on the image, the lightbox shows the corresponding image. But no luck thus far.
Here's what I mean:
How can I extract the current "s.src" parameter and use it on the "img src" tag to display the image accordingly?
View 4 Replies
View Related
Feb 12, 2010
I've been advised that the only way to accomplish this is via some hand-coded javascript, at which I'm a complete noob, so hopefully someone here might be able to steer me in the right direction.I have a listings page which displays results using images and text which are stored in a MySQL database, all is working fine. The images are pulled into the page from the database and each listing can have up to a maximum of 10 images. Some will have all 10, some probably one or two, so the page is coded such that if there's an image in the field, it displays a thumbnail, if there isn't then it shoves a " " in instead.The results page has one main photo (image 1) and then a series of thumbnails (images 2-10) below it and I need to be able to set this up so that when someone clicks on image 2 it shows the full-size version of that image in the div where image1 sits, and the same for however many remaining images there are.
So my question is, how easy it is to do this with javascript and does anyone have any idea how to code it?The main photo sits in a div whose id is "mainphoto" the remainder all sit in a div whose id is "thumbpix".
View 1 Replies
View Related
Sep 30, 2009
I have an html file with 1000 exam questions in this format code...
table 1 is stacked on top of table 2, which is stacked on table 3.
each of the 1000 questions is formatted like this.
I want to reorder it to this for all 1000 questions code...
View 5 Replies
View Related
Jun 15, 2010
I am a novice with JavaScript, and I was wondering how I would reorder a list of data. I googled this and found some ways but none of them really applied to me.
I have a database with names of courses (its for a restaurant), they all have an ID which ranges from 1-8 (I only have 8 courses so far). I can add and delete courses from this table but I would like to be able to reorder theses courses, in other words change their ID, without having to go into the database and manually change itself.
View 6 Replies
View Related
Jun 15, 2010
how I would reorder a list of data. I googled this and found some ways but none of them really applied to me. I have a database with names of courses (its for a restaurant), they all have an ID which ranges from 1-8 (I only have 8 courses so far). I can add and delete courses from this table but I would like to be able to reorder theses courses, in other words change their ID, without having to go into the database and manually change itself.
View 6 Replies
View Related
Feb 12, 2010
I have a listings page which displays results using images and text which are stored in a MySQL database, all is working fine. The images are pulled into the page from the database and each listing can have up to a maximum of 10 images. Some will have all 10, some probably one or two, so the page is coded such that if there's an image in the field, it displays a thumbnail, if there isn't then it shoves a " " in instead.
The results page has one main photo (image 1) and then a series of thumbnails (images 2-10) below it and I need to be able to set this up so that when someone clicks on image 2 it shows the full-size version of that image in the div where image1 sits, and the same for however many remaining images there are.
So my question is, how easy it is to do this with javascript and does anyone have any idea how to code it?
The main photo sits in a div whose id is "mainphoto" the remainder all sit in a div whose id is "thumbpix".
View 1 Replies
View Related
Sep 6, 2009
I have a list where I want to reorder the list on each user click. for example,
<ul>
<li name="li_one"><a href="one.html">one </a></li>
<li name="li_two"><a href="two.html">two</a></li>
<li name="li_three"><a href="three.html">three</a></li>
</ul>
If the user selects "two", then the list order should be sorted as follows
[Code]...
the selected item should always appear first in the list. Is it possible to do with javascript?.
View 4 Replies
View Related
Jul 20, 2005
I have pages that I want a particular person to download dozens of images.
Instead of opening each image separately with right-clicks, I want to be
able to have them simply click, and the program will offer to save all the
images to a location they specify. Can I do that with JavaScript?
View 5 Replies
View Related