Re: HTML_Form vs Quickforms

From: Date: Fri, 10 Jan 2003 12:53:52 +0000
Subject: Re: HTML_Form vs Quickforms
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-12234@lists.php.net to get a copy of this message
if (browser_is_good_enough()) {
    continue;
} else {
    // create a normal Quickform::textbox element
    exit;
} Do you know of any good PHP scripts that can detect if the browser can handle DHTML properly (preferably without using browscap.ini, because not everybody has that installed)
The best way to detect browser is to use javascript on the client side, if you use javascript to write the image that you click on, then you can silently degrade in non-js browsers. Javascript for IE/NN6+ and moz is the same (think its the same for opera etc, but i have never really tried[i think it uses IE engine so is ok]). I think it would look something like this (although I dont know how this would integrate into the existing code) <input type="text" name="<?php echo $name ?>"> <script>
        //action functions here
        document.write(image_code);
        if (document.getElementById()){
                // ie4+/nn6+/moz
                document.write(layer/div_code);
        }
        // if you really want to include nn4 (personally id rather let it die a graceful death)
        else if (document.layers){
                document.write(layer/div_code);
        }
</script>

« previous php.pear.dev (#12234) next »