TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mukesh kumar
NA
259
2.2k
addEventListener not working on content page.
Oct 6 2018 10:58 PM
when i run this code on asp.net content page then it's not working and error message comes that "0x800a1391 - JavaScript runtime error: 'btn' is undefined" but when i run this code on html page then it's execute without any errors.
<input type="button" value="Click" id="btn" />
<script type="text/javascript">
btn.addEventListener("mouseover", changeColorOnMouseOver, false);
btn.addEventListener("mouseout", changeColorOnMouseOut, false);
function changeColorOnMouseOver() {
this.style.background = 'red';
this.style.color = 'yellow';
}
function changeColorOnMouseOut() {
this.style.background = 'black';
this.style.color = 'white';
}
</script>
Reply
Answers (
1
)
Can we implement javascript in Servlets for UI
Image Animations