Nov 8, 2009

Need Help With Javascript Drag And Drop Script - Having trouble with javascript drag and drop script.

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Need Help With Javascript Drag And Drop Script - Having trouble with javascript drag and drop script.

minimcmonkey
hi, i have been trying to create a drag and drop menu for my new website, so that the navigation menu can be moved around the site. This is the code i have:

CODE
<html>
<head>
<title>Test run - Right click menu</title>

<script type="text/javascript">
function coordinates(event)
{
if (event.button==2)
  {
var x=event.x;
var y=event.y;
}

document.getElementById("element").style.left=x;
document.getElementById("element").style.top=y;
document.getElementById("element").style.visibility="visible";
var oldx=x;
var oldy=y;
window.onmouseup=end();
window.onmousemove=coordinates(event);
}

function end()
{
}
</script>






<style type="text/CSS">
#element {
position: absolute;
top: 0px;
left: 0px;
background-color: 568934;
border: 3px dashed;
visibility: hidden;
z-index: 1;
}
</style>
</head>
<body bgcolor="112233" onmousedown="coordinates(event)" oncontextmenu="return false;">

<div id="element">
hi<br>
<table>
<tr>
<th onmousedown="coordinatesb(event)">hi</th>
</tr>
</table>
hi<br>
hi<br>
hi<br>
hi<br>
hi<br>
hi<br>
</div>



</body>
</html>


When i run this (in Internet Explorer) it says
"out of memory at line 8"
and there are errors at lines 14 an 51,
when i remove line 14, the error is seen on line 15 instead (because they do virtually the same thing)
At the moment, i havent made it work in firefox or any other browsers, and dont intend to until it works with IE. I am aware that it doesnt account for scrolling, but im adding all that stuff later.
Can anyone help?

I have tried using a javascript debugger, and syntax chgecker, ect, but i still can fix it...
any ideas?

 

 

 


Comment/Reply (w/o sign-up)

Nabb
On line uh... 52... you wrote coordinatesb instead of coordinates.

Not quite sure and I don't feel like debugging at the moment, but try using variable names that aren't x and y, that might be causing a problem.

Comment/Reply (w/o sign-up)

minimcmonkey
I will try that, although i did build this using part of the code i used when i made a right click menu script, and the X and Y named variables worked fine then.
thanks, ill give that a go.
I did try using a variable debugger, but i didnt get any errors.

Comment/Reply (w/o sign-up)

(G)Author Name - e.g. John, Mike

Thanks a lot John Mike (or to whoever made this no-drag-and-drop script possible)!! You have truly made my day, because I've been looking for a good way to protect my images on the internet, and by far this is the best method I've come across!! Once again, thanks a lot!! :DD


Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : javascript, drag, drop, script, trouble, javascript, drag, drop, script,

  1. Javascript Game
    Free online dice game called "Greedy" (6)
  2. Re-learning Javascript
    (3)
    As rusty as I was with ActionScript when I started my new job, I'm even rustier at JavaScript.
    I'm trying to generate a new div on a webpage, containing an html file that (at the moment)
    holds only a simple .gif image. The page looks like this at the moment: function
    creatediv(id, html, width, height, left, top) { var newdiv =
    document.createElement('div'); newdiv.setAttribute('id', id); if (width)
    { newdiv.style.width = 300; } if (height) { newdiv.style.height = 250; }
    if ((left || ....
  3. Java Script To Hide The Url In Address Bar
    Does any one know about this ? (8)
    Hello friends , just now i came accross a particular type of script which is capable of masking the
    URL which is seen in the Address bar of the webpage , that is by implementing the particular Java
    Script when the user visits a page eg. www.mysite.com , then it is possible for the admin of
    www.mysite.com to mask this site and display some other website in the viewers address bar. I came
    to know that such a script can be written using Java Scripts , Can any one get me the Script ??....
  4. Adjusting Rows/cols Of Frames In Frameset Using Javascript Is Not Working In Firefox 3 Is Not Working
    (4)
    I am not able to adjust frames length/width in a frameset using java script functions I am using
    firefox 3. In below code changerows is not working for me. Where as same is working in IE6.
    Please help me in resolving this issue. Note: here frameset1 is the name given to the FRAMESET.
    CODE function changeRows() { parent.frameset1.rows="30%,70%" }function restoreRows() {
    parent.frameset1.rows="50%,50%" } ....
  5. Java Vs Javascript
    (11)
    I thought they were completely different things. Surely javascript should be seperated from the rest....
  6. Document.write & Noscript Questions (javascript)
    (2)
    I am trying to use javascript to include a stylesheet depending on the user's resolution. The
    HTML CODE    " />    id) { initEditor(); } ?>                 if
    (screen.width>=1050) { document.write(' '); }       I'm running into two
    problems. 1) The script doesn't seem to be writing anything. Fixed 2) The tags cause all
    sorts of validation errors. From what I've read it seems as though the tag is not allowed
    within the section -- is this correct? Could the same thing be accomplished just putting the
    default style....
  7. Flash And Javascript Interaction
    swfobject js questions (1)
    I don't know if anyone on here is familiar with this script. You can check it out here .
    Basically it's a script that is supposed to give you javascript control over a flash object. I
    am using it for a flv player. My question is this. I would like to display the current file's
    title in a span element on the page, but the function described to gather the information for the
    current file doesn't seem to work for me. The function, as outlined on on this page looks
    like this: CODE function getUpdate(typ,pr1,pr2,swf) {   if(typ == 'state'....
  8. Javascript Object Node Referencing Help
    (5)
    I've got two buttons with an onclick event to set the hidden input field to a certain value then
    continue submitting the form. I have more than one form on display on the page and I don't want
    to use ids. Is there a way I can reference it from the button/button onclick event? the forms is
    laid out like this echo" "; echo" "; echo" Edit "; echo" Delete "; echo" ";
    So basically the idea is to fire off new_modify function and start referencing the hidden input type
    with name of do and set it to the supplied argument then continue submitting t....
  9. Capturing Username Of Computer
    using javascript, is it possible? (3)
    I wondering if it is possible to try and make a java script to get the computer username and log it?
    /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /> edit Topic
    title ....
  10. Simple Firefox Vs. Ie Script Bug; Need A Little Help
    Simple script works in Firefox but not IE. (3)
    Hello I have a simple .js file that seems to work in Firefox but not IE. The error could totally be
    my syntax, just not sure why it's working in one browser and not the other. All I'm doing
    is waiting for an image to load completely before redirecting. I added an extra step that waits an
    additional 1.5 seconds just for 100% smooth transition (sometimes firefox reroutes before the image
    is actually fully loaded). This script works perfectly for Firefox, meaning if the image is already
    loaded/cached it reroutes immediately and if not, then waits with extra dela....
  11. Lottery Script Help
    (5)
    I have written a simple lottery script that I want to manually use with my InvisionPlus forum and
    main web site. Currently I have a page with the lottery script on my main page that can be accessed
    from a redirection forum on my forums. The script creates a button on the lottery page of my main
    site that creates a number entry prompt that acts as a password field. If the lotto number is
    correct, then my user is taken to my winners forum where they post they won. The purpose of the
    lotto is for members to win account upgrades. My script though is not working. Here is the ....
  12. Jsp Or Java Chat Script Like Mig33
    (5)
    so most of you guys know mig33. its a wap application,probaly java.most kindly to be java. does
    anyone have java knowlege or knows where i can get a chat script like mig33? i also know this server
    supports jsp so im planing to use it for my application. i was hosted here last year but moved
    because i found a better host. now im back just to use the jsp on this server. Im planing to run
    chat applictions so if any one wants to help me in my project let me know.....
  13. Problem With Java Script Popup Form
    Doesnt work in Safari (1)
    This code wont work in Safari, but works fine in Firefox 2. Can someone help. The error pops up
    however. It just doesn't do anything unless you dont pick one and then it says Pick a Windows
    tweak, but if you DO pick one it doesnt even try to load anything. Everything you see below is
    everything inside my PHP Include. If you would like to view my actual site it's
    http://boozkerstweaks.trap17.com There might be PHP errors and stuff right now, but i am working on
    those, but this i can not get. CODE                      Tweak Archive        Top Tweaks of
    2....
  14. Hiding <div> Boxes With Javascript
    Javascript Help #1 (8)
    This is my first help post in this Java/JavaScript section. Can someone write/find me a piece of
    code that will hide boxes? Preferred stuff: There is a bar that has the subtitle of the box
    contents. A button on the right side of the bar shows and hides the div box. Contents are in a box
    with a border and slides in and out of the bar smoothly and relatively quickly. Box MUST be
    customizable using CSS internal/external stylesheets . Any help would be appreciated. All codes
    will be tested and best code be selected.....
  15. Javascript : No Right Click Script !@
    This script will allow you to protect your source coad ! (12)
    This script will help you to protect your source code Add this to Section of your site !
    HTML var message="Function Disabled!"; /////////////////////////////////// function
    clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if
    (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){
    alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmoused....
  16. What's The Relationship Between Javascript And Java
    are they the same or different (7)
    I think most of you always confuse about java and javascript .So I make this topic to talk about it.
    Javascript and Java ,they have the same first four letter. Java and Javascript is the two language
    is very popular in the web world.Java is the general-purpose programming language that you can
    create an application or an applet.Javascript is a script language that looks sort of like java;with
    it you can do various nifty things in web pages.They are independent languages ,used for different
    purposes.If you are interesting in creating a website you should learn how to w....
  17. Adding Rows & Columns In Html Table Using Javascript
    (4)
    I'm trying to create a website with a form that collects some user information to store in MySQL
    database. However, I've a problem when I want to dynamically add new rows and columns in the
    HTML table so that the user can add more information in the dynamically added textboxes. Here's
    what I have: CODE                                                       
                        Quantity                                                           
                        unit(s)                                                         
                 ....
  18. One Click Copy And Paste To Clipboard
    in simple Javascript (5)
    I've been search the web for few weeks to see if Java can do one click copy and paste function
    to the clipboard and then I can just Ctrl-V the copied "texts." I initially got this idea when I
    began to approve hosting application. Instead of writing the same message over and over again, I
    decided to make me a page where I can simply copy the code to appropriate answers. And seems like my
    laziness is the mother of inventions /laugh.gif' border='0' style='vertical-align:middle'
    alt='laugh.gif' /> Instead of doing Ctrl-A, Ctrl-C then Ctrl-V to the post board I started....
  19. Javascript Close Window
    Javascript close window (19)
    Hi does anyone have a code to close the browser window. This code needs to be used to close an
    actual full sized window, not a pop-up window.....
  20. How Can I Resize The Web Browser?
    using javascript (5)
    how can i resize the window with javascript, and how to center an element in the browser window?
    thanks a lot!!! /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' />
    Corrected title spelling. This is more appropriate in Programming section. Please, please make sure
    that you post in the right section. ....
  21. File Upload Script In Java
    File Upload Script in JAVA (5)
    Hi, I am developing my personal website in JSP. I need a file upload script written in JAVA. I got a
    script that is Upload Bean from javazoom.com but the problem is its working fine on Windows
    Operating SYstem but not working on LINUX server. When i pass LINUX path (like
    /home/usr/public_html) to bean it gives me error Check UploadBean properties in your JSP. I
    think this bean aspecting a windows path. Can anyone provide me JSP Smart Upload script or any
    other file upload bean in JAVA. For your information Smart Upload website has been closed. My
    email id is ....
  22. Javascript Window.open
    Plz help me ,, thanks (5)
    When I try to run the following code in Internet Explorer I get an "Invalid argument" error but it
    works fine on Firefox CODE window.open("users/ve_edit.php","edit
    av","toolbar=no,location=no,directories=no,status=no,sc
    rollbars=no,resizable=no,copyhistory=no,width=600, height=400"); plz help me /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> ....
  23. [help] Java Script: Window.open
    Works with Firefox, not IE (10)
    CODE var popUpWin=0; function popUpWindow(URLStr) {  if(popUpWin)  {  
     if(!popUpWin.closed) popUpWin.close();  }  popUpWin = open(URLStr, 'GunBound Tactics:
    Screenshots',
    'width=820,height=550,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top=90,left=90'); }
    Clips This is a script for opening a new window. It works with Firefox and not
    Internet Explorer. IE gives a script error and it references a part of the code that has nothing to
    do with the script. Someone please tell me if you can figure out why. Used at this add....
  24. How To Insert Code With Javascript
    How to insert into a div an amount of code (11)
    Hi, I have the next html page CODE function insertcode() { var code =" blablabal babala
    babababab here comes header fadfafa anchor blalbababa " var myText =
    document.createTextNode(code); document.getElementById("content").appendChild(myText); } -->
    Insert Code This code insert the data as text. The html tags are not treated like markup.
    I need to insert the code in a time. I mean i can not go tag per tag. (E.g.
    document.createElement("p")... ) Is there any method to insert a pice of html code into a div and
    keep it like code not like tex....
  25. Javascript Slideshow Tutorial
    How to make a slideshow in JavaScript (14)
    JavaScript Slideshow Tutorial I'm going to show you how to make a impressive JavaScript
    slideshow. First, you're probably asking: why would I want to make a slideshow in JavaScript?
    There are a number of reasons. First, you don't have to build a new HTML page for each picture.
    Secondly, the page will load much faster because the of the compactness of the page. Ok let's
    get started with this example. First we'll add a tag in the of our HTML document. In that
    script tag we will build the following: CODE      first = 1;      last = 4;   ....
  26. Java Script Drop Down Menu With Css
    - a full code for a dynamic drop down (2)
    Introduction This is a code that I use to dynamically create the drop down menus. First, you have
    to edit the following code and put it in your Javascript. Notice : /*** SET BUTTON'S FOLDER HERE
    ***/. Edit that to your folder. Also, the /*** SET BUTTONS' FILENAMES HERE ***/. This creates a
    mouseover when the drop down is activated. Put all your onmouseover images under: oversources = new
    array; and your onmouseout images under : upsources. Be sure to set your on and out images above
    each other. CODE /*** SET BUTTON'S FOLDER HERE ***/ var buttonFold....
  27. Java Is Not Javascript; Javascript Is Not Java
    (2)
    Java, developed under the Sun Microsystems brand, is a full-fledged object-oriented programming
    language. It can be used to create standalone applications and a special type of mini application,
    called an applet. Applets are downloaded as separate files to your browser alongside an HTML
    document, and provide an infinite variety of added functionality to the Web site you are visiting.
    The displayed results of applets can appear to be embedded in an HTML page (e.g., the scrolling
    banner message that is so common on Java-enhanced sites), but the Java code arrives as a separ....
  28. Learning Javascript.
    -->What I know and a question<-- (7)
    How hard is it to fully learn javascript? People say it is easy, however, it looks pretty
    complicated! What do I know, you ask? I know how to make a button (that I describe in another
    post) so that when you click it, it generates something at random. I have the script for it here:
    var quotes = ; function getQuote() { var qs = document.getElementById("quote"); var quote =
    quotes quotes ; alert(quote); } Describe button here. . . . . . Original script
    copyright by ROADDHOGG....
  29. Java Script Sites
    (6)
    this is the best websites for javascript and other javascript.internet.com javascriptkit.com
    webdeveloper.earthweb.com/webjs www.javascript.com www.dynamicdrive.com/
    www.webdeveloper.com/javascript www.javascriptworld.com/scripts www.java-scripts.net
    www.hotscripts.com www.totalscripts.com www.123webmaster.com www.needscripts.com www.reallybig.com
    www.a1javascripts.com javascript.programmershelp.co.uk
    developer.netscape.com/tech/javascript/resources.html
    www.mountaindragon.com/javascript/resources.htm i'll make like this in cgi and php if u love
    it???so....... ....
  30. Javascript resources?
    ie, a book. (10)
    Hi, I'm trying to learn Javascript. The thing is, I don't have any reference material
    around, so I'm gonna need to buy a book or something. Are there any which you would recommend? I
    looked on some websites but there are literally hundreds of books of this kind. /blink.gif"
    style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /> (in answer to the
    below, sorry sauron, didnt see that one)....

    1. Looking for javascript, drag, drop, script, trouble, javascript, drag, drop, script,
Similar
Javascript Game - Free online dice game called "Greedy"
Re-learning Javascript
Java Script To Hide The Url In Address Bar - Does any one know about this ?
Adjusting Rows/cols Of Frames In Frameset Using Javascript Is Not Working In Firefox 3 Is Not Working
Java Vs Javascript
Document.write & Noscript Questions (javascript)
Flash And Javascript Interaction - swfobject js questions
Javascript Object Node Referencing Help
Capturing Username Of Computer - using javascript, is it possible?
Simple Firefox Vs. Ie Script Bug; Need A Little Help - Simple script works in Firefox but not IE.
Lottery Script Help
Jsp Or Java Chat Script Like Mig33
Problem With Java Script Popup Form - Doesnt work in Safari
Hiding <div> Boxes With Javascript - Javascript Help #1
Javascript : No Right Click Script !@ - This script will allow you to protect your source coad !
What's The Relationship Between Javascript And Java - are they the same or different
Adding Rows & Columns In Html Table Using Javascript
One Click Copy And Paste To Clipboard - in simple Javascript
Javascript Close Window - Javascript close window
How Can I Resize The Web Browser? - using javascript
File Upload Script In Java - File Upload Script in JAVA
Javascript Window.open - Plz help me ,, thanks
[help] Java Script: Window.open - Works with Firefox, not IE
How To Insert Code With Javascript - How to insert into a div an amount of code
Javascript Slideshow Tutorial - How to make a slideshow in JavaScript
Java Script Drop Down Menu With Css - - a full code for a dynamic drop down
Java Is Not Javascript; Javascript Is Not Java
Learning Javascript. - -->What I know and a question<--
Java Script Sites
Javascript resources? - ie, a book.

Searching Video's for javascript, drag, drop, script, trouble, javascript, drag, drop, script,
See Also,
advertisement


Need Help With Javascript Drag And Drop Script - Having trouble with javascript drag and drop script.

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com