使用像facebook这样的模式确认远离页面的导航?

时间:2014-02-05 14:38:24

标签: javascript jquery html twitter-bootstrap navigation

我正在尝试使用bootbox.js给出一个模态确认框。这是 fiddle ..

我的代码看起来像这样,但问题是本机javascript确认使用bootbox插件遮盖了我的自定义确认框:

$(window).bind('beforeunload', function(){
   var conf = "All unsaved changes will be lost, are you sure you want to leave the page?";         

   return bootbox.confirm(conf, function(result) 
            {
                return result;
            });
        });

任何人都可以告诉我这是什么问题或者帮助我理解哪里出错了??

提前致谢

1 个答案:

答案 0 :(得分:0)

在这种情况下使用jQuery。我添加了一个课程'确认'为方便起见,锚标签。您可以使用

阻止默认行为
no persistent classes found for query class: SELECT distinct
pf.projectFormId FROM com.gsk.rd.craw.model.ProjectForm pf   left join
pf.contacts c WHERE pf.createdBy=:mudid OR pf.modifiedBy=:mudid OR
c.mudid=:mudid 

java.lang.IllegalArgumentException:
org.hibernate.QueryParameterException: could not locate named
parameter



18:33:04,338 TRACE [org.hibernate.engine.query.spi.QueryPlanCache]
(http-/127.0.0.1:8080-1) Unable to locate HQL query plan in cache;
generating (SELECT distinct pf.projectFormId FROM
com.gsk.rd.craw.model.ProjectForm pf   left join pf.contacts c WHERE
pf.createdBy=:mudid OR pf.modifiedBy=:mudid OR c.mudid=:mudid )
18:33:04,338 TRACE [org.jboss.modules] (http-/127.0.0.1:8080-1)
Finding class com.gsk.rd.craw.model.ProjectForm from Module
"deployment.craw.ear:main" from Service Module Loader 18:33:04,338
TRACE [org.jboss.modules] (http-/127.0.0.1:8080-1) Finding local class
com.gsk.rd.craw.model.ProjectForm from Module
"deployment.craw.ear.craw_jar.jar:main" from Service Module Loader
18:33:04,338 TRACE [org.jboss.modules] (http-/127.0.0.1:8080-1) Found
previously loaded class com.gsk.rd.craw.model.ProjectForm from Module
"deployment.craw.ear.craw_jar.jar:main" from Service Module Loader
18:33:04,339 WARN  [org.hibernate.hql.internal.QuerySplitter]
(http-/127.0.0.1:8080-1) HHH000183: no persistent classes found for
query class: SELECT distinct pf.projectFormId FROM
com.gsk.rd.craw.model.ProjectForm pf   left join pf.contacts c WHERE
pf.createdBy=:mudid OR pf.modifiedBy=:mudid OR c.mudid=:mudid 
18:33:04,339 INFO  [stdout] (http-/127.0.0.1:8080-1)
0000000000000000000000000000000003333333333333333333333333


18:33:04,346 TRACE [org.jboss.modules] (http-/127.0.0.1:8080-1)
Finding local class org.hibernate.internal.AbstractQueryImpl from
Module "org.hibernate:main" from local module loader @3c20902c
(finder: local module finder @7dd9578a (roots:
D:\CRAW_JBOSS7.2\aries-sandbox\jboss-as-7.2.0.Final\modules,D:\CRAW_JBOSS7.2\aries-sandbox\jboss-as-7.2.0.Final\modules\system\layers\base))
18:33:04,346 TRACE [org.jboss.modules] (http-/127.0.0.1:8080-1) Found
previously loaded class org.hibernate.internal.AbstractQueryImpl from
Module "org.hibernate:main" from local module loader @3c20902c
(finder: local module finder @7dd9578a (roots:
D:\CRAW_JBOSS7.2\aries-sandbox\jboss-as-7.2.0.Final\modules,D:\CRAW_JBOSS7.2\aries-sandbox\jboss-as-7.2.0.Final\modules\system\layers\base))
18:33:04,341 SEVERE [facelets.viewhandler] (http-/127.0.0.1:8080-1)
Error Rendering View[/ProjectFormCatalog.jsp]:
java.lang.IllegalArgumentException:
org.hibernate.QueryParameterException: could not locate named
parameter [mudid]

然后在bootbox回调中执行其他过程,并在用户提供响应后导航。

e.preventDefault