2013-03-13 92 views
0

我想從這個網站實現MSGBOX: http://jquerymsgbox.ibrahimkalyoncu.com/jQuery的MSGBOX給出錯誤信息

到我的web應用程序。我跟着解釋相關:

<head> 
<script type="text/javascript" src="/Timesheets/Java/MsgBox/Scripts/jquery-1.8.0.min.js"></script> 
<link rel="stylesheet" type="text/css" href="/Timesheets/java/msgbox/styles/msgBoxLight.css" /> 
<script type="text/javascript" src="/Timesheets/Java/MsgBox/Scripts/jquery.msgBox.js"></script> 
</head> 

<body> 
<script> 
function sign() { 
    $.msgBox("The selection includes process white objects. Overprinting such objects is only useful in combination with transparency effects."); 
    /* 
    busyBox.Show(); 
    PageMethods.signe($("#form1").serializeArray(), getParameterByName("pn"), user, signcomp, signfail); 
    */ 
} 
</script> 

<input type="button" name="okbtn" ID="okbtn" class="mybutton13" value="Test button" onclick="sign()" runat="server" /> 
</body> 

但每次我按一下按鈕,我得到一個錯誤:對象不支持屬性或方法「MSGBOX」消息

謝謝大家的幫助

編輯:

火狐給我:類型錯誤:$ .msgBox不是一個函數

IE給我錯誤:對象不支持屬性或方法「MSGBOX '

+0

msg功能是否確定了JS包含文件'被正確包括jquery.msgBox.js'?該文件是否真的存在於該位置? – jonkroll 2013-03-13 18:35:18

+0

我點擊它的Firefox的源代碼,它給了我請求的頁面,所以是可以訪問的。 – Olivier 2013-03-13 18:36:18

回答

0

最後我使我自己的彈出框,要求使用動態內容從Javascript

0

嘗試使用jQuery click()處理程序將msgBox函數附加到按鈕,而不是使用button標記的onClick屬性。

另請注意,$ .msgBox()將javascript對象作爲參數,而不是字符串。

<script> 
$(document).ready(function() { 
    $('#okbtn').click(function() { 
     $.msgBox({ 
      title:"Title goes here", 
      content:"Content goes here" 
     }); 
    }); 
}); 
</script> 
+0

試着把'B'換成相同的結果 – Olivier 2013-03-13 18:30:09

0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> 
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>jquery.msgbox Demos</TITLE> 
<META content="text/html; charset=UTF-8" http-equiv=Content-Type> 
<LINK rel=stylesheet type=text/css href="jquery.msgbox.css"> 
<SCRIPT type=text/javascript src="http://code.jquery.com/jquery-latest.min.js"></SCRIPT> 
<SCRIPT type=text/javascript src="jquery.dragndrop.min.js"></SCRIPT> 
<SCRIPT type=text/javascript src="jquery.msgbox.js"></SCRIPT> 

<SCRIPT language=JavaScript type=text/javascript> 
$(function(){ 

    $("#test1").click(function(){ 
     new $.msgbox('Hello world').show(); 
    }); 

    $("#test2").click(function(){ 
     new $.msgbox({ 
      width:500, 
      height:500, 
      title: 'Hello', 
      content: 'Hello, world!', 
      bgOpacity: .8 
     }).show(); 
    }); 

    $("#test3").click(function(){ 
     new $.msgbox({ 
      allowDrag: false // enable drag and drop(default), disable if false 
     }).show(); 
    }); 

    $("#test4").click(function(){ 
     new $.msgbox({ 
      onClose: function(){ 
       alert(this.titleWrap.html()); // this is refered to the object itself 
      } 
     }).show(); 
    }); 

    $("#test5").click(function(){ 
     new $.msgbox({ 
      autoClose: 10 // do not counting down 
     }).show(); 
    }); 

    $("#test6").click(function(){ 
     new $.msgbox({ 
      autoClose: 0 // do not counting down 
     }).show().startAutoClose(10); // start counting down, support chain operations 
    }); 

    $("#test7").click(function(){ 
     new $.msgbox({ 
      type: 'alert', 
      content: 'Hello' 
     }).show(); 
    }); 

    $("#test8").click(function(){ 
     new $.msgbox({ 
      onClose: function(){ alert(this.getValue()) }, // with onclose plugin 
      type: 'confirm', 
      content: 'Hello' 
     }).show(); 
    }); 

    $("#test9").click(function(){ 
     new $.msgbox({ 
      onClose: function(){ alert(this.getValue()) }, 
      type: 'input', 
      content: 'Enter your words:' 
     }).show(); 
    }); 

    $("#test10").click(function(){ 
     new $.msgbox({ 
      //onAjaxed: function(){ alert('Loading complete') }, 
      type: 'ajax', // or url 
      content: 'http://pwwang.com' 
     }).show(); 
    }); 

    $("#test11").click(function(){ 
     new $.msgbox({ 
      type: 'iframe', 
      content: 'http://pwwang.com' 
     }).show(); 
    }); 

    $("#test12").click(function(){ 
     new $.msgbox({ 
      anim: 1 // 0, 2, no animation with other values 
     }).show(); 
    }); 

    $("#test13").click(function(){ 
     new $.msgbox({ 
      showClose: false // disable in options 
     }).show(); 
    }); 

    $("#test14").click(function(){ 
     new $.msgbox({ 
      closeIcon: 'image:close.gif' // or 'text:Close', or 'image:close.png' to display an image 
     }).show(); 
    }); 
    $("#okbtn").click(function(){ 
     new $.msgbox({ 
      showClose: false // disable in options 
     }).show(); 
    }); 

}); 

</SCRIPT> 

<META></HEAD> 
<BODY> 
<input type="button" id="test1" value="1.The simplest way" /><br /> 
<input type="button" id="test2" value="2.With otions" /><br /> 
<input type="button" id="test3" value="3.Plugin dragndrop, drag and drop disabled" /><br /> 
<input type="button" id="test4" value="4.Plugin onclose" /><br /> 
<input type="button" id="test5" value="5.Plugin autoclose" /><br /> 
<input type="button" id="test6" value="6.Plugin autoclose, set by public function" /><br /> 
<input type="button" id="test7" value="7.Plugin contenttype, alert" /><br /> 
<input type="button" id="test8" value="8.Plugin contenttype, confirm" /><br /> 
<input type="button" id="test9" value="9.Plugin contenttype, input" /><br /> 
<input type="button" id="test10" value="10.Plugin contenttype, ajax/url" /><br /> 
<input type="button" id="test11" value="11.Plugin contenttype, iframe" /><br /> 
<input type="button" id="test12" value="12.Plugin animate, animate type 1" /><br /> 
<input type="button" id="test13" value="13.Plugin showclose, showClose=false" /><br /> 
<input type="button" id="test14" value="14.Plugin closeicon" /><br /> 
<input type="button" name="okbtn" ID="okbtn" class="mybutton13" value="Test button" /> 
</BODY> 
</HTML> 
1

我有同樣的問題的密碼。然後我通過用msg代替$.msgBox解決了這個問題。現在它的工作很好。

$('#okbtn').click(function() { 
msg({ 
    title:"Title goes here", 
    content:"Content goes here", 
    type:"Type goes here" 
    }); 
}); 

我從jquery.msgBox.js