我一直在尝试向我的网站添加通知栏,这需要一些javascript代码,我添加了它,但我收到错误未被捕Typerror:
Uncaught TypeError: Cannot set property 'disabled' of null
我的代码是
<script src="js/classie.js"></script>
<script src="js/notificationFx.js"></script>
<script>
(function() {
var svgshape = document.getElementById( 'notification-shape' ),
bttn = document.getElementById( 'notification-trigger' );
// make sure..
bttn.disabled = false;
bttn.addEventListener( 'click', function() {
// create the notification
var notification = new NotificationFx({
wrapper : svgshape,
message : '<p>Test!</p>',
layout : 'other',
effect : 'loadingcircle',
ttl : 9000,
type : 'notice', // notice, warning or error
onClose : function() {
bttn.disabled = false;
}
});
// show the notification
notification.show();
// disable the button (for demo purposes only)
this.disabled = true;
} );
})();
我怎样才能解决这个问题呢?