我正在尝试从锚标记打开一个对话框。 我的HTML是:
<head>
<title>show dynamic dialog box in jquery</title>
<link href="style/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="scripts/jquery-1.5.js"></script>
<script src="scripts/jquery-ui-1.8.js"></script>
<script src="scripts/my_script.js"></script>
</head>
<body>
<div style="width:400px;height:600px;">
<input id="Button1" type="button" value="Save" /> // this works!
<!--a href="#dialog" id ="Button1">Open</a-->// this is the line I want to use
</div>
</body>
</html>
my_script.js is:
$(document).ready(function(){
$(function() {
$("input:button").click(function() {
var NewDialog;
var _id = $(this).attr('id');
if (_id === "Button1") {
NewDialog = $('<div class="popup" title="PITCH">\
Pitch is the relationship between a note and it\'s fundamental requency.</div>');
}
NewDialog.dialog({
resizable: false,
modal: true,
show: 'clip',
buttons: {
"Close": function() {
$(this).dialog("close");
}
}
});
});
});
});
我的问题是:如何使用锚标记执行此操作,如注释掉的行: 开放&LT; / A - &GT;
这让我疯了三天,我已多次搜索答案。任何帮助将不胜感激
答案 0 :(得分:0)
你可以使用类似的东西:
$("#Button1").click(function (event) {
event.preventDefault();
NewDialog = $('<div class="popup" title="PITCH">\
Pitch is the relationship between a note and it\'s fundamental requency.</div>');
}
NewDialog.dialog({
resizable: false,
modal: true,
show: 'clip',
buttons: {
"Close": function() {
$(this).dialog("close");
}
}
});
});