Javascript 我如何使用toastr?
我喜欢我能用toastr做什么的想法,但我似乎无法让它发挥作用 从官方页面Javascript 我如何使用toastr?,javascript,html,toastr,Javascript,Html,Toastr,我喜欢我能用toastr做什么的想法,但我似乎无法让它发挥作用 从官方页面 (1) Link to toastr.css (2) Link to toastr.js (3) Use toastr to display a toast for info, success, warning or error To install toastr, run the following command in the Package Manager Console Install-Package toast
(1) Link to toastr.css
(2) Link to toastr.js
(3) Use toastr to display a toast for info, success, warning or error
To install toastr, run the following command in the Package Manager Console
Install-Package toastr
我下载了NuGet的命令行版本,输入了install toastr
,并成功安装了它(尽管我不知道它实际上做了什么……),然后在我的页面test.php
,我有以下代码:
<html>
<head>
<link rel="stylesheet" href="/toastr.css">
<script type="text/javascript" src="/toastr.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
</head>
<body>
toastr.info('Hey - it works!');
</body>
但当我执行页面时,我看到的是:
toastr.info('嘿,它工作了!')
我做错了什么?您只需在close body标记之前添加脚本标记,还可以在valida javascript范围内使用它
.. all html page
<script>
$(document).ready(function() {
// show when page load
toastr.info('Hey - it works!');
});
</script>
</body>
</html>
您可能想查看一个基本的javascript教程,我想我不知道如何使用javascript,为了使用它,我需要这样做。我将代码
$(document.ready)(函数(){//show when page load to astr.info('page Loaded!');$('linkButton')。单击(函数(){//show when the button is click to astr.success('click button');})代码>进入我的页面,但它没有做任何事情,它只是回显代码。。。。我需要用什么东西包装它吗?所有javascript代码必须在和标记之间,否则浏览器将无法识别它为javascript。
.. all html page
<script>
$(document).ready(function() {
// show when page load
toastr.info('Hey - it works!');
});
</script>
</body>
</html>
// for success - green box
toastr.success('Success messages');
// for errors - red box
toastr.error('errors messages');
// for warning - orange box
toastr.warning('warning messages');
// for info - blue box
toastr.info('info messages');