www.webdeveloper.com
Results 1 to 2 of 2

Thread: How does one create something like this? what tags?

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    11

    How does one create something like this? what tags?

    http://futhead.com/12/squadcreator

    if you open that link above and see, you must first choose a 'formation' then when hovering with a mouse over a position that comes up after choosing your formation, you can start to type in a name of a player which then brings a list up with players containing what you typed, in their name.. if you click the player you are looking for it will display the card of that player in the position you chose..

    I know it's Java, I'm a really new beginner to it and I don't know what kind of tags would be involved, how it is made, anything!

    All replies are greatly appreciated, thank you

    you can also right click and go to 'view page source' if that helps you to understand and then help me

  2. #2
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    The page requires registration which is probably going to stop most people looking any further, by the way.

    Since I can't see the page (sorry, but I'm not registering), I will assume you want the same functionality as the Google search engine? I.e. it will bring up search results matching the words you're typing in before actually performing any search.

    It's simple to achieve, you'll need to have some basic JavaScript knowledge as well as PHP/MySQL. What you're seeing is JavaScript connecting to the server via AJAX, which basically means JavaScript is creating an HTTP request via XMLHttpRequest/ActiveXObject, and a PHP file is executing some code, returning the results to JavaScript and thus, the document.

    The following code is an AJAX request which will open a PHP file and have the results returned:

    Code:
    function get_php()
    {
        var xmlhttp = "";
     
       // IE7+, Firefox, Chrome, Opera, Safari.
        if (window.XMLHttpRequest)
            xmlhttp = new XMLHttpRequest();
        // IE6, IE5.  
        else
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
     
        xmlhttp.onreadystatechange = function()
        {
            if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
            {
                alert(xmlhttp.responseText);
                // Handle HTTP response here.
            }
        }
     
        xmlhttp.open("GET", "some_page.php", true);
        xmlhttp.send();
    }
    I've written an article on how this works if you're interested. It's "how to check username availability with AJAX", but all the code you need is available in the tutorial. You'll just have to set up your PHP file to echo out the results of your given database table(s).
    Last edited by George88; 08-06-2012 at 01:53 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles