現在、開発者用のデザインチュートリアルサイトをコーディングしています。エンドユーザーが古いものを使用している場合、基本的に小さな警告をスローするコードスニペットがありますIEのバージョンを画面に表示します。このPHPブラウザ固有の警告に問題があります
それは聞こえないので、それはクライアントが望むものです。しかたがない。
「このボックスを閉じる」リンクをクリックすると、基本的に私はこの問題を閉じることができません。ここにコードがあります。助言がありますか?
<?php
// IE6,7,8 string from user_agent
$ie6 = "MSIE 6.0";
$ie7 = "MSIE 7.0";
$ie8 = "MSIE 8.0";
// detect browser
$browser = $_SERVER['HTTP_USER_AGENT'];
// yank the version from the string
$browser = substr("$browser", 25, 8);
// html for error
$error = "<div class=\"error\" id=\"error\"><strong>Alert:</strong> It appears that you
are using Internet Explorer 6, 7, or 8. While you may still visit this website we
encourage you to upgrade your web browser so you can enjoy all the rich features this
website offers as well as other websites. Follow this link to <a
href=\"http://www.microsoft.com/windows/downloads/ie/getitnow.mspx\"><strong>Upgrade
your Internet Explorer</strong></a><br /><div class=\"kickRight\"><a href=\"javascript:
killIt('error');\"> Close This Box</a></div></div>";
// if IE6 set the $alert
if($browser == $ie6){ $alert = TRUE; }
if($browser == $ie7){ $alert = TRUE; }
if($browser == $ie8){ $alert = TRUE; }
?>
そして、あなたがそれをすることがどこBODYにこれを追加します。
<!-- IE6 Detect Advise Notice -->
<?php if($alert){ echo $error; } ?>
<!-- // end IE6 Detect Advise Notice -->
が、私はこれを閉じるための気を得ることができません。私は問題が何であるか分からない。 PHPエラーボックスを閉じるためにjavascriptがあるかもしれません。私はc言語を知らないので知らない。お手数ですが
はい、ここにJavaScriptが含まれています。関数名は 'killIt'です。 – ceejayoz
この壊れやすいPHP混乱の代わりに条件付きコメントを使用してボックスを表示する必要があります。 – deceze
私はこれを研究します。しかし、このPHPボックスは正常に動作します。私はそれを閉じることができません。ですから、それが簡単な修正であれば、私はそれに固執します。 killIt()関数は機能しません。私はPHPで形成された関数を殺すことを試みているjavascriptコマンドだからだろうか? –