* サーバー側は、小松氏のこれをbloga.jp:80へ置いてあります。
* クライアント側はWS処理をjQueryプラグイン化してみました。これです。
* ちなみに、このDemoサンプルは、下記5行でローカルでも別ドメインでもどこにでも設置出来ます。
<script src="http://bloga.jp/ws/jq/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="http://bloga.jp/ws/jq/js/jquery.ws-0.3-noenc-pre.js" type="text/javascript" charset="utf-8"></script>
<script src="http://bloga.jp/ws/jq/conn/wschatdemo0.3.js" type="text/javascript"></script>
<script>/*サポートしてない時のalertメッセージを抑止*/$.ws.wsSetup({nonosupportmsg:true});</script>
<div id="wsdemos"></div>
【info】いつもいろいろなテストなどをページ内のあちこちでやっているので、重かったり、壊れていたりするf^^;ことも多いです。実験用ですので、カオス(混沌)をあえて意図したりもしますので、標準やValidとは無縁だったりしますが、何卒、ご了承ください ( _ _ b
【info】
最近はTwitterでぶつぶつ言ってることが多いです。
>http://twitter.com/toshirot
【info】
Chrome Extension [WebSocket Chat] もちろんChrome専用です
https://chrome.google.com/extensions/detail/fnoegeafibddabfhmpmhniphlcojkjli
class属性値をgetAttributeで取るときは、下記に注意。すっかり忘れてました(^^;
oj.getAttribute('class') ←FireFox,Opera,Safari
oj.getAttribute('className') ←IE
クロスブラウザな書き方は下記でOK
oj.getAttribute('class')||oj.getAttribute('className')
例
if(oj.getAttribute('class')||oj.getAttribute('className')=='xxx'){ ... }
if((oj.getAttribute('class')||oj.getAttribute('className'))=='xxx'){ ... }
oda さんの仰るとおり、 == の方が || より優先されますね。
var attr = oj.getAttribute('class')||oj.getAttribute('className')=='xxx';
とすると、
Gecko では、 attr には属性値が入り、
Trident では、属性値が 'xxx' と等しいか評価した結果(boolean)が入るようです。
意図通りの分岐を書くなら、
if ( ( oj.getAttribute('class')||oj.getAttribute('className') ) == 'xxx' ){ ... }
ですかね。
おぉ、なんと素早いつっこみありがとうございます(^^;;
直しました。
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |




