啊!这怎么了?$(document).ready(function() { var monkeyTrouble = $('#monkeyTrouble').attr('rel'); if (monkeyTrouble = "banana") { alert("oooh oooh ahh ahhh"); } }); 最佳答案 认为您正在寻找这个...if (monkeyTrouble == "banana") { 希望有帮助!