Total members 11889 |It is currently Thu Mar 28, 2024 11:28 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





If you want to make drag and drop in your website , i think the following example will be helpful to you .The example is based on javascript script language .There is two files html for test and javascript and it is the core of the example ,

index.html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
   <head>
       <title>Drag and drop in website using javascript</title>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <script type="text/javascript" src="drag.js"></script>
   </head>
   <body>

      <div id="container">


<div id="info">Start drag process...</div>
<div id="square" style="position: relative; width: 60px; height: 60px; background:#990033; border: 2px solid #3399CC;"></div>



<script type="text/javascript">

   function begin (element, x, y) {
      var s = '#' + element.id + ' (begin drag)' + ' x:' + x + ', y:' + y;
      updateInfo(s);
   }

   function drag (element, x, y) {
      var s = '#' + element.id + ' (dragging)' + ' x:' + x + ', y:' + y;
      updateInfo(s);
   }

   function end (element, x, y) {
      var s = '#' + element.id + ' (end drag)' + ' x:' + x + ', y:' + y;
      updateInfo(s);
   }

   function updateInfo(s) {
      document.getElementById('info').innerHTML = s;
   }

   var square = DragHandler.attach(document.getElementById('square'));



   square.dragBegin = begin;
   square.drag = drag;
   square.dragEnd = end;


</script>



      </div>

   </body>
</html>


and the javascript file




Attachments:
File comment: drag and drop javascript file
drag.js [1.98 KiB]
Downloaded 4046 times
File comment: screenshot image
untitledjj.JPG
untitledjj.JPG [ 5.05 KiB | Viewed 24690 times ]

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada
Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

What is the code for making windows pop up as javascript windows? I've seen the coding before and its something like "javascript:open" or something... I'm not really sure... Could anyone give me the link coding to do that? Thanks.
____________________
affiliateelite ~ affiliateelite.com ~ adgooroo ~ adgooroo.com


Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Drag and Drop using javascript
 Drag and Drop     -  
 Drag and Drop in java     -  
 how to create a mouse over drop down in html ?     -  
 Validation of php drop down menu of months,days and years     -  
 need help with javascript     -  
 JavaScript     -  
 javascript help with BMI     -  
 need help in javascript     -  
 Javascript     -  
 i need help in javascript     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com