When the first time I learned javascript code, I was really happy when I succeed to make pop up dialog, :D
And now I will share a simple code to make a confirmation dialog before you do the actions.
I have some ways, but the simple one is:
<a href="http://bywebs.blogspot.com" onClick="return confirm('Do you realy want to visit my website?');"> My Website </a>
Demo
Beside that I also have the second way, but it will use a function.
Let's take a look
<script type="text/javascript">
function _confirm(url){
if(confirm('Do you realy want to show my link?')){
document.getElementById('myDiv').innerHTML = "<a href='"+url+"'> My Website</a>";
}
}
</script>
<a onClick="_confirm('http://bywebs.blogspot.com');">show my link</a>
<div id="myDiv"></div>
Demo
That's all :).
Hope it will useful, if you have any question , just write your comment below.
Thanks and Good luck
No comments:
Post a Comment