Web Analytics Made Easy -
StatCounter Need some help with some code please - CodingForum

Announcement

Collapse
No announcement yet.

Need some help with some code please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need some help with some code please

    Hello,

    I am trying to use an image to pass a URL without the user noticing.

    The code I have is as follows:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <script type="text/javascript" language="javascript">
    function makeRequest(url) {
    var http_request = false;
    
    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
    http_request.overrideMimeType('text/xml');
    // See note below about this line
    }
    } else if (window.ActiveXObject) { // IE
    try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
    }
    }
    
    if (!http_request) {
    alert('Giving up :( Cannot create an XMLHTTP instance');
    return false;
    }
    http_request.onreadystatechange = function() { alertContents(http_request); };
    http_request.open('GET', url, true);
    http_request.send(null);
    
    }
    
    function alertContents(http_request) {
    
    if (http_request.readyState == 4) {
    if (http_request.status == 200) {
    alert(http_request.responseText);
    } else {
    alert('There was a problem with the request.');
    }
    }
    
    }
    </script>
    
    
    <title>Untitled Document</title>
    </head>
    
    <body>
    
    
    <A HREF="#" onClick="makeRequest('http://192.168.0.100/hid.spi?com=AA1;80:')"><IMG SRC="images/blank_lrg.png"></a>
    
    </body>
    </html>
    But is doesnt work.
    Any pointers as to what is wrong please?

    Thanks,

    Simon
Working...
X