QQ線上狀態代碼_網路衝浪

來源:互聯網
上載者:User
但是騰訊的這個頁面改過版了,我是今天才發現的。用以前的代碼已經不能點擊開啟聊天視窗了,產生的新代碼比以前長了,多了個sigkey,64位的(好長 )。
以我的QQ為例子,在那個頁面產生的程式碼如下:
複製代碼 代碼如下:

<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=cfad9f0a103b59616e94d667dd5755e92c2be98ded5ad949a940399e013adfe2"; target=_blank; onclick="var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=cfad9f0a103b59616e94d667dd5755e92c2be98ded5ad949a940399e013adfe2';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC='http://wpa.qq.com/pa?p=1:56536321:2' alt="56536321"></a>

是不是很長?而且就這樣放進網頁,那麼頁面肯定過不了W3C認證,SRC是大寫,再如“;target=_blank; ”。如果要放好幾個QQ,那頁面豈不是也很亂。怎麼辦?
我對比了兩個QQ,發現只有那個64位的sigkey不一樣,所以可以把onclick移出來,代碼: 
複製代碼 代碼如下:

<script type="text/javascript">
function QQtalk(sigkey) {
var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey='+sigkey;
var oldscript=document.getElementById('testJs');
var newscript=document.createElement('script');
newscript.setAttribute('type','text/javascript');
newscript.setAttribute('id', 'testJs');
newscript.setAttribute('src',tempSrc);
if(oldscript == null) {
document.body.appendChild(newscript);
}
else {
oldscript.parentNode.replaceChild(newscript, oldscript);
}
return false;
}
</script>

然後直接onclick="return QQtalk('cfad9f0a103b59616e94d667dd5755e92c2be98ded5ad949a940399e013adfe2');"

網頁body內的代碼可以寫成: <a href="http://sighttp.qq.com/cgi-bin/check?sigkey=cfad9f0a103b59616e94d667dd5755e92c2be98ded5ad949a940399e013adfe2" target="_blank" onclick="return QQtalk('cfad9f0a103b59616e94d667dd5755e92c2be98ded5ad949a940399e013adfe2');"><img src="http://wpa.qq.com/pa?p=1:56536321:3" alt="56536321"></a>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.