Click here to Skip to main content
Licence 
First Posted 12 Jun 2006
Views 27,601
Bookmarked 23 times

How to Drag drop in javascript across frames(Part II)

How to do Drag and Drop object across frame
3 votes, 30.0%
1

2
1 vote, 10.0%
3
1 vote, 10.0%
4
5 votes, 50.0%
5
3.05/5 - 10 votes
μ 3.05, σa 3.22 [?]

Download sourcecode

Introduction

In article "How to Drag Drop in javascript (Part I)", we have seen how to drag and drop objects. Now consider that there is requirement to drag some object from one frame and drop it to another frame.Also clicking on particular slide (image object)we need to maximize that slide .This document explains how to achieve this using javascript.

 

How to Drag Drop in javascript (Part I) is available at

http://www.codeproject.com/useritems/DragDrop_Part-1_.asp

Approach

Since object which will be dragged and dropped to different frames we need to store Id of object at common place which will be accessible from both frames.Best place is to store these Ids in container of frames .

Sample Code

Consider that we declare two varaibles in container frame as follows.

   

var srcElementId; //Id of dragged object

var destElementId; //Id of valid drop target object 

 

Now we can set or get these variables in child frame.Container frame can be accessed using parent object.

 

e.g

function fnGetSource()

{

   parent.srcElementId = event.srcElement.id ;

}  

 

Here we are setting dragged object id to variable declared in parent frame container.

   

Sample Application

Consider sample application where we need to drag image from one area and drop it to another as shown in following screens 1 and 2.

Sample screenshot

 

Sample screenshot

 

Sample screenshot

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Vishal Nagarkar

Web Developer

India India

Member
vishal

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 PinmembercoolestCoder5:41 15 Apr '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 12 Jun 2006
Article Copyright 2006 by Vishal Nagarkar
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid