开发者

Javascript alert box

So I am trying to make it so a user clicks a button to email me, a js alert box pops up with a message and then after they click ok it goes forward with the email link. This is my code thus far:

<a href="mailto:wildfire@wfithaca.com.com">
<a href='javascript:开发者_如何学运维window.alert("All reservations must be made by phone!");'>
<img src="http://wfithaca.com/wp-content/themes/zenlite/images/mailicon.png" />
</a>
</a>

Any help would be greatly appreciated!


Try:

<a href="mailto:wildfire@wfithaca.com.com" onclick="alert('All reservations must be made by phone!');">
<img src="http://wfithaca.com/wp-content/themes/zenlite/images/mailicon.png" />
</a>


//javascript 

function alertAndRedirect(text, email) {
 alert(text);
 window.location.replace("mailto:" + email);
}

<!--HTML -->
<a href='javascript:alertAndRedirect("All reservations must be made by phone!","wildfire@wfithaca.com.com");'>
<img src="http://wfithaca.com/wp-content/themes/zenlite/images/mailicon.png" />
</a>

Hope this helps...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜