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
Gaurav Raj
NA
475
88.5k
unable to set property 'onclick' of undefined
Feb 2 2018 4:41 AM
unable to set property 'onclick' of undefined and img
please help me
THIS is my modal.js file code
// Get the modal
var
modal = document.getElementById(
'myModal'
);
// Get the image and insert it inside the modal - use its "alt" text as a caption
var
img = document.getElementById(
'<%= ImgProfile.ClientID %>'
);
var
modalImg = document.getElementById(
"img01"
);
//var captionText = document.getElementById("caption");
img.onclick =
function
() {
alert(
"hello"
);
modal.style.display =
"block"
;
modalImg.src =
this
.src;
// captionText.innerHTML = this.alt;
}
// Get the <span> element that closes the modal
var
span = document.getElementsByClassName(
"close"
)[0];
// When the user clicks on <span> (x), close the modal
span.onclick =
function
() {
modal.style.display =
"none"
;
}
THIS is my home.aspx file code
<
asp:Image
ID
=
"ImgProfile"
runat
=
"server"
src
=
"Images/19251082_10215259476544325_53831408_n.jpg"
CssClass
=
"img-thumbnail"
/>
<
div
id
=
"myModal"
class
=
"modal"
>
<
span
class
=
"close"
>
×
</
span
>
<
img
class
=
"modal-content"
id
=
"img01"
/>
<
div
id
=
"caption"
>
</
div
>
</
div
>
Reply
Answers (
2
)
How to develop Detached digital signature certificate?
store procedure