473,396 Members | 2,050 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,396 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 3120
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.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.