我有类似在javascript中执行字符串变量的内容作为代码行吗?
“_onmouseover”: “this.className = this.className.replace( '悬停', '')”;
我试图像
buttonObject.onmouseover =函数(){ 窗口[this.someObject._ _onmouseover]()执行它; };
而且我不知道它有多可能。
让我告诉你们我的情景。我正在创建这个插件,在jquery对话框中生成四种类型的对话消息。那些是'警告','错误','注意'和'确认'。因此,让我们说在dom中有4个跨度应该触发这四个。
<span id='DialogueWarning'> Warning </span>
<span id='DialogueError'> Error </span>
<span id='DialogueNote'> Note </span>
<span id='DialogueConfirm'> Confirm </span>
现在让hadle点击表示对话
jQuery('#DialogueWarning').click(function(){
var dialogue = new Dialogue({
"type":"Warning",
"message":"Are you sure you want to close this window without saving your changes?",
"buttons":
[
{
"text":"Close without saving",
"_onmouseover": "this.className+=' hover'",
"_onmouseout":"this.className=this.className.replace(' hover', '')",
"bClass":"e_customButton"
},
{
"text":"Don't Close",
"_onmouseover": "this.className+=' hover'",
"_onmouseout":"this.className=this.className.replace(' hover', '')",
"bClass":"e_customButton"
}
],
"closeOnBackgroundClick" : true
});
});
参见 “_onmouseover” 和_onmouseout啄,我需要这些。有什么办法可以通过其他方式
你可以在对话中显示按钮的处理吗? – Anoop