Reputation: 946
I have this script
written in my original webpage:
<script>
var marcoemail="aaaaaa";
function pippo(){
document.getElementById("marcoemailid").innerHTML=marcoemail;
}
window.onload = pippo;
</script>
But the mail client when sends the page to the email address, this script
is not executed. I tried body.onload
, document.onload
, window.onload
, but still it does not work.
Upvotes: 0
Views: 683
Reputation: 98
Probably you're going a wrong way...
Do this....
1 write a javascript code inside the page within <script></script>
tag. here
<script>
var marcoemail = "aaaa";
function pippo(){
document.getElementById("marcoemailid").innerHTML=marcoemail;
}
</script>
You should execute this function on body onload event then you should be modified body tag like this
<body onload ="pippo()">
Now it will working fine....
Upvotes: 0
Reputation: 1516
As stated in the comments, all known email clients ignores <script>
tags and inline js in multi-part email content. Also, some of the major email-clients such as Gmail webmail and, MSN webmail strips out the <head>
tag all together so a general design rule is to keep everything (css) inline.
There is a good article bringing up scripts in email over at Campaign monitor.
If you can, you should try to strip the html content from script tags prior to sending it as an email as content including script tags will have an effect on the email´s spam score in most spam filters.
Upvotes: 1