我正在为webtrees制作自定义主题。 webtrees使用了很多弹出窗口,我想用jquery对话框替换它们,但是我不想弄乱核心代码。所以jquery脚本必须重写原始函数和onclick事件。我在互联网上搜索过,但没有找到解决方案。希望你们中的一些人能帮助我。用jQuery对话框替换javascript弹出窗口
这是我要重写的功能之一:
var helpWin;
function helpPopup(which, mod) {
if (which==null) which = "help_contents_help";
if (mod!='') which=which+'&mod='+mod;
if ((!helpWin)||(helpWin.closed)) {
helpWin = window.open('help_text.php?help='+which,'_blank','left=50,top=50,width=500,height=320,resizable=1,scrollbars=1');
} else {
helpWin.location = 'help_text.php?help='+which;
}
return false;
}
function closeHelp() {
if (helpWin) helpWin.close();
}
的HTML看起来是这样的:
<a class="help" onclick="helpPopup('index_charts','charts'); return false;" href="#">
我尝试了jQuery的对话框几个jQuery的解决方案,但没有一次成功。
任何解决方案?
你是否收到任何JS错误?我想你应该,因为你需要在引号中点击'',像这样:''点击'' – 2012-01-04 22:46:15
不,我没有得到任何错误。这不是我的功能,而是我试图覆盖的webtrees的核心功能。我只是给这个函数来明确什么是当前的弹出功能,但我想用jquery对话框替换它。 – JustCarmen 2012-01-04 22:57:59