Results 1 to 5 of 5

Thread: Perl + DHTML

  1. #1
    Join Date
    Jun 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Perl + DHTML

    Hello, I was just using this tooltip thing Here . I have a perl script that returns just some plain text when it's called and I was wondering if anyone knew how to make it so that the text from the perl script will show up in the boxes.

    I guess I'm just not sure how to make the perl script run and store the information without actually clicking the link. I just want the information to show up in the pop up window when rolled over.

    Thanks.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Perl is server side.... it's not interactive... must be run on the server then it outputs text/etc.
    You may wish to call it via AJAX, like you would with php. I'd look into that.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So I guess you can't just get the server to run the script when you rollover things? Do you know any good AJAX resources or tutorials or anything? Any more information would be helpful. Thanks.

    -Joe O'Hallaron

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Add this:
    Code:
              var xht = (function() {
                    if(typeof ActiveXObject == "undefined" && typeof XMLHttpRequest == "undefined") return null;
                    var xmlhttp;
                    /*@cc_on
                        @if (@_jscript_version >= 5) {
                            try {
                                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                            } catch (e) {
                                try {
                                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                                } catch (E) {
                                    xmlhttp = false;
                                }
                            }
                        }
                        @else xmlhttp = null;
                    @end @*/
    
                    if (xmlhttp == null && typeof XMLHttpRequest != 'undefined') {
                        try {
                            xmlhttp = new XMLHttpRequest();
                        } catch (e) {
                            xmlhttp = null;
                        }
                    }
                    return xmlhttp;
                })();
    Take this function:
    Code:
    function ddrivetip(thetext, thecolor, thewidth){
    if (ns6||ie){
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
    tipobj.innerHTML=thetext
    enabletip=true
    return false
    }
    }
    Replace it with this:
    Code:
    function ddrivetip(theurl, thecolor, thewidth){
    if (ns6||ie){
    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
    if(xht) {
      xht.open("GET", theurl, false);
      xht.send(null);
      tipobj.innerHTML = xht.responseText;
    } else tipobj.innerHTML = "Unfortunately, an error has occurred.  Please report this to the site administrators, including the browser you were using at the time and what you were attempting to do.";
    enabletip=true
    return false
    }
    }
    Use the URL to your Perl script instead of the text to display.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Feb 2006
    Posts
    236
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default

    Nice and concise. BTW, this thread is already Googled.

Bookmarks

Posting Permissions

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