$(document).ready(function(e) { var pc=$(window).width(); if(pc<=640){ $('.nr_qq').attr("href","mqqwpa://im/chat?chat_type=wpa&uin=&version=1&src_type=web&web_src=oicqzone.com"); } });