/    Sign up×
Community /Pin to ProfileBookmark

Total Programming Beginner – needs easy help (hopefully)

OK – I am totally not a programmer – most of the time I just take public scripts and tweak them a little for my simple needs, but I can’t figure this one out. Any help appreciated!

I have a page where I have been using a js to “hide” email addresses from spambots. Recently, there was a need to add a cc: to one of the addresses on the page, but not the other. I could have done this if it was for both addresses, but not for just one! Here is the script as I have it now (which does both addresses.) How would I change this to just do one?

(In <head> section>)

[INDENT]

<script language=”JavaScript” type=”text/javascript”>
<!–
var domain = “maindomain.com”;

var at = “@”;
var copi = “?cc=copiedmail”;
var copidomain = “copydomain.com”;

function email_me(username)

{

var complete_email = “mailto:” + username + at + domain + copi + at + copidomain;

window.status = complete_email;

location.href = complete_email;

}

function sb_write_email(username)

{

var complete_email = “mailto:” + username + at + domain + copi + at + copidomain;

window.status = complete_email;

}

function sb_clear_email()

{

window.status = “”;

}

//–>

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//–>
</script>

[/INDENT]

In link on page:

[INDENT]
<a href=”javascript:void();” onClick=”email_me(‘main_email1’)” OnMouseOver=”sb_write_email(‘main_email1’);return true” onMouseOut=”sb_clear_email();return true”>Click here to email First Person </a></p>

<a href=”javascript:void();” onClick=”email_me(‘main_email2’)” OnMouseOver=”sb_write_email(‘main_email2’);return true” onMouseOut=”sb_clear_email();return true”>Click here to email Second Person </a></p>

[/INDENT]

I want to change this script up so that the cc works on the first email address, but not the second one. Right now it is working, but for both of them.

Please let me know if I am not making sense – – and thank you for any help you can give me.

  • Tiffany
  • to post a comment
    JavaScript

    6 Comments(s)

    Copy linkTweet thisAlerts:
    @ChikaraSep 26.2007 — Hmmm. I see your problem, and it's a little complicated.

    Is there only one e-mail address that should get a CC message out of many?
    Copy linkTweet thisAlerts:
    @ChikaraSep 26.2007 — [CODE]<html>
    <head>


    <script language="JavaScript" type="text/javascript">
    <!--
    var domain = "maindomain.com";
    var at = "@";
    var copi = "?cc=copiedmail";
    var copidomain = "copydomain.com";

    function email_me(username)
    {
    var complete_email = "mailto:" + username + at + domain;
    window.status = complete_email;
    location.href = complete_email;
    }

    function sb_write_email(username)
    {
    var complete_email = "mailto:" + username + at + domain + copi + at + copidomain;
    window.status = complete_email;
    location.href = complete_email;
    }

    function sb_clear_email()
    {
    window.status = "";
    }
    //-->

    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }
    //-->
    </script>
    </head><body><a href="javascript:void();" onClick="email_me('main_email1');">Click here to email First Person </a></p>

    <a href="javascript:void();" onClick="sb_write_email('main_email2');" >Click here to email Second Person </a></p>
    </body>
    </html>[/CODE]


    This *MIGHT* work. The 1st link will only e-mail one person. The 2nd link will e-mail and CC a person. I do not quite know how this might effect things elsewhere, but in the example above it worked.
    Copy linkTweet thisAlerts:
    @quimbydogauthorSep 26.2007 — Hmmm. I see your problem, and it's a little complicated.

    Is there only one e-mail address that should get a CC message out of many?[/QUOTE]


    Actually, it's a little more complicated than that - I just said one so I could get the basic idea and apply it to my needs. There are actually 7 email addresses and 4 of them need (the same) cc:

    I thought about adding a new vairiable to the script and just making it blank if they didn't get the cc:, but I couldn't figure it out.

    T
    Copy linkTweet thisAlerts:
    @ChikaraSep 26.2007 — Actually, it's a little more complicated than that - I just said one so I could get the basic idea and apply it to my needs. There are actually 7 email addresses and 4 of them need (the same) cc:

    I thought about adding a new vairiable to the script and just making it blank if they didn't get the cc:, but I couldn't figure it out.

    T[/QUOTE]

    You could do that. Or you could just call a different method. I'm a little curious why you have a function called sb_write_email and email_me. Basically, they do the same thing, just e-mail me pops up a new mail window. Here is how you would add a new variable to the script.

    function email_me(username, cc)

    {

    if(cc == 'yes')

    var complete_email = "mailto:" + username + at + domain + copi + at + copidomain;

    else

    var complete_email = "mailto:" + username + at + domain;

    window.status = complete_email;

    location.href = complete_email;

    }

    That is giving you an argument that will control if CC is used or not. This is what the link would look like.

    <a href="javascript:void();" onClick="email_me('main_email1', 'yes')" OnMouseOver="sb_write_email('main_email1');return true" onMouseOut="sb_clear_email();return true">Click here to email First Person </a></p>

    <a href="javascript:void();" onClick="email_me('main_email1', 'no')" OnMouseOver="sb_write_email('main_email1');return true" onMouseOut="sb_clear_email();return true">Click here to email First Person </a></p>
    Copy linkTweet thisAlerts:
    @quimbydogauthorSep 26.2007 — You could do that. Or you could just call a different method. I'm a little curious why you have a function called sb_write_email and email_me. Basically, they do the same thing, just e-mail me pops up a new mail window. Here is how you would add a new variable to the script.

    function email_me(username, cc)

    {

    if(cc == 'yes')

    var complete_email = "mailto:" + username + at + domain + copi + at + copidomain;

    else

    var complete_email = "mailto:" + username + at + domain;

    window.status = complete_email;

    location.href = complete_email;

    }

    That is giving you an argument that will control if CC is used or not. This is what the link would look like.

    <a href="javascript:void();" onClick="email_me('main_email1', 'yes')" OnMouseOver="sb_write_email('main_email1');return true" onMouseOut="sb_clear_email();return true">Click here to email First Person </a></p>

    <a href="javascript:void();" onClick="email_me('main_email1', 'no')" OnMouseOver="sb_write_email('main_email1');return true" onMouseOut="sb_clear_email();return true">Click here to email First Person </a></p>[/QUOTE]


    I just took this basic script from a free script site, I kind of wondered that too - I guess thier bad programming is now my bad programming when I don't know what I am doing!

    Thanks for this and let me put it in and see if I can get it to work.

    T
    Copy linkTweet thisAlerts:
    @quimbydogauthorSep 26.2007 — Thank you!

    Thank you - I got it to work, and took out the sb_write_email because as you pointed out it wasn't needed.

    I appreciate the help!?
    ×

    Success!

    Help @quimbydog spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...