Results 1 to 8 of 8

Thread: Alerting x/y

  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Exclamation Alerting x/y

    Right, drag and drop works fine. I made a function so when you click save it runs a function to get the x&y co-ordinates... and for now alert them so i know its working.

    PHP Code:
    <?php 
    ob_start
    (); 
    include(
    "config.php"); 
    function 
    save() 
    {
    $topval document.getElementById('example').style.top;
    $leftval document.getElementById('example').style.left;
    echo(
    "
    <script>
    alert ('
    $topval $leftval') 
    </script>
    "
    );
    }
    ?>
    <html>
    <head>
    <title>OurHabbo</title>
    <link href="ourhabbo.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="dom-drag.js"></script>
    </head>
    <body class='content'>
    <span class='contentHeading'>Drag & Drop Practise</span><br><Br>
    <img id="example" src="lips_small.gif" style="position: relative" />
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    <a href='#' onClick='javascript: save();return true'>Save</a>
    </body>
    </html>
    Theres the coding, but when i click Save, it wont alert the co-ordinates.

  2. #2
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    Thats php mate.. try javascript :S

  3. #3
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Kk, so how would i do it =]
    Last edited by Romanity; 08-05-2007 at 04:12 PM.

  4. #4
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    your mixing both php functions with javascript functions, interesting...

  5. #5
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Im far from good with functions (A)

    Sooooo, how would i go about getting the position of "example" and then alert the user with them?

  6. #6
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    HTML Code:
    <script>
    function save() 
    {
    var top = document.getElementById('example').style.top;
    var bot = document.getElementById('example').style.left;
    
    alert(top bot)
    }
    </script>
    I think?

  7. #7
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Code:
    <?php 
    ob_start(); 
    include("config.php"); 
    function save() 
    {
    $topval = document.getElementById('example').style.top;
    $leftval = document.getElementById('example').style.left;
    ?>
    <script>
    alert ("<?php echo "$topval $leftval"; ?>") 
    </script>
    <?
    }
    ?>
    <html>
    <head>
    <title>OurHabbo</title>
    <link href="ourhabbo.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="dom-drag.js"></script>
    </head>
    <body class='content'>
    <span class='contentHeading'>Drag & Drop Practise</span><br><Br>
    <img id="example" src="lips_small.gif" style="position: relative" />
    <script type="text/javascript">
    Drag.init(document.getElementById("example"));
    </script>
    <a href='#' onClick='javascript: save();return true'>Save</a>
    </body>
    </html>


  8. #8
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    None of the codes seem to code... could it be the save link aswell as the coding?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •