Total members 10262 | Gratitudes |It is currently Thu May 24, 2012 9:39 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 2 posts ] 
Author Question
 Question subject: Drag and Drop using javascript
PostPosted: Tue Dec 02, 2008 1:56 am 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2279
Location: Earth
Has thanked: 39 time
Have thanks: 61 time

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 3010 times
File comment: screenshot image
untitledjj.JPG
untitledjj.JPG [ 5.05 KiB | Viewed 17313 times ]

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Drag and Drop using javascript
PostPosted: Thu May 14, 2009 11:24 am 
Offline
Newbie
User avatar

Joined: Thu May 14, 2009 5:49 am
Posts: 2
Has thanked: 0 time
Have thanks: 0 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


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 2 posts ] 
Quick reply


  

 Similar topics
 JavaScript fade out problem
 javascript read file
 getting gst, pst total to diplay in my javascript form
 need help with javascript
 Drag and Drop in java
 Javascript select menu validation issue
 validate age entered as selection box in javascript
 Trim string in JavaScript
 check array contains a value using javascript
 Javascript Multi-dimensional Arrays

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 2 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team