473,418 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

how to cut/paste & copy/paste images using javascript

hi,

currently I am able to cut,copy and paste images for only one image.

Suppose I have 4 images-then I should group all the images so that I can cut/copy all 4 images and paste them. How can I do this?

I have used an array to store all the images.

If you have any code for this please send it to me or a website link.
Else logic as to how am I to Proceed.


waiting for the reply.
Jun 1 '07 #1
6 3123
acoder
16,027 Expert Mod 8TB
Well, if you can do it for one image, just loop through the array for all images:
Expand|Select|Wrap|Line Numbers
  1. for(i = 0; i < imgArray.length; i++) {
  2.  img = imgArray[i];
  3.  //whatever you want to do with the image
  4. }
Jun 1 '07 #2
hi,

I am new to javascript.How to copy and paste 2 or more images using javascript?


Please send the code or the link. It will be helpful.
Jun 4 '07 #3
hi,

I am new to javascript? I need a code to cut and paste 4 images using javascript.


please send me the code or the link for this.
Jun 4 '07 #4
acoder
16,027 Expert Mod 8TB
Threads merged. You've already started a thread on this, please do not double post.

Have you tried what I posted earlier? Post some code that you've managed so far.
Jun 4 '07 #5
Threads merged. You've already started a thread on this, please do not double post.

Have you tried what I posted earlier? Post some code that you've managed so far.

the code which I have tried to delete one image is given below:
I have called the destroy(); function using keydown event in a switch statement.
sh is the image object.

case 46: //delete code-ascii value of delete key
destroy();
destroyall();
break;
function destroy()
{
sh.parentNode.removeChild(sh);
}

function destroyall()
{
alert('destroyall');
if(selectall) //var selectall=true;
{
alert('entered if');
for(var i=1;i<shapestore.length;i++) //shapestore is an array which holds all images
{ //alert(shapestore.length);
alert('enter for');
//shapeid is the id of a particular image
clipboard=sh.shapeid;
//img=sh..shapestore[i];
sh.parentNode.removeChild(clipboard);

//delete shapestore[i];
// var rm=sh.parentNode.removeChild(sh);
// delete rm.id;
}
}
}
Jun 5 '07 #6
sumittyagi
202 Expert 100+
the code which I have tried to delete one image is given below:
I have called the destroy(); function using keydown event in a switch statement.
sh is the image object.

case 46: //delete code-ascii value of delete key
destroy();
destroyall();
break;
function destroy()
{
sh.parentNode.removeChild(sh);
}

function destroyall()
{
alert('destroyall');
if(selectall) //var selectall=true;
{
alert('entered if');
for(var i=1;i<shapestore.length;i++) //shapestore is an array which holds all images
{ //alert(shapestore.length);
alert('enter for');
//shapeid is the id of a particular image
clipboard=sh.shapeid;
//img=sh..shapestore[i];
sh.parentNode.removeChild(clipboard);

//delete shapestore[i];
// var rm=sh.parentNode.removeChild(sh);
// delete rm.id;
}
}
}

Here you have used the removeChild method.

Now for adding elements you have appendChild or, insertBefore methods.

Just you would have to give ids to the element containers, so that when you want to paste them you can get those elements.

Or if you want to paste them by mouse events, then you could get the ev.getSource (or something similar to this, I don't exactly remember)
Jun 5 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tomomichi Amano | last post by:
Hello. I was wondering how to paste-copy-cut-delete at a SELECTED SPOT in a textBox. Thanks in advance.
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
3
by: Mateusz Rajca | last post by:
Hello, How can I add copy paste and cut to my browser in C#? I have the menu items labeled Copy, Paste and Cut. Now I just need the code? Mateusz
1
by: mlikesit | last post by:
I am trying to get the following code to pre-load some images before re-dirrecting the user. The problem is that the onError event gets called for all of the images immediately. I've tripple...
2
by: veera venkata | last post by:
hello, i had two html images tags with scrollbars. if i scroll the one of the image then the second images has to move together along with first one. anyone can help me in that.
0
by: kavi2012 | last post by:
Hi I used the following function to disable the cut, Copy & paste in the Textbox. It works fine for me when I use ctrl+C,ctrl+X & ctrl+V. function disable(e) { if(event.ctrlKey) { ...
3
by: dileepkms | last post by:
can we disable copy and paste functionality for excel sheet using javascript? if we do it, can you send me the code
4
by: swethak | last post by:
Hi, How to crop the images using javascript.plz help me.how to start logic for that.
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.