我有一个对象
var Messages = {
'fullName' : 'Tell us your cool name dude..! e.g. Yousuf Iqbal',
'userName' : 'Choose a catchy username. Remember! It should be available :)',
'password' : 'Choose a top secret password with special chars, numbers and alphabets',
'rePassword' : 'Retype the password you just typed. But, don\'t try to copy!',
'bYear' : 'Tell the year, in which this bomb blasted'
};
和一个变量..
var attribute = $('#userinfo form input').attr('name');
现在我想像这样使用这个变量来选择消息对象属性..
var message = Messages.attribute;
但它不起作用..并且还尝试了以下..
var message = Messages+'.'+attribute;