1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I need a good tell a friend script. Thnak you!

Discussion in 'JavaScript' started by ST12, Feb 4, 2006.

  1. #1
    I need a good tell a friend script. Thnak you!
    st12
     
    ST12, Feb 4, 2006 IP
  2. pwaring

    pwaring Well-Known Member

    Messages:
    846
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    135
    #2
    Are you sure you want to use JavaScript for this? As far as I'm aware, it can't send email directly so how do you expect to use it to tell people about the site in question?
     
    pwaring, Feb 4, 2006 IP
  3. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #3
    mad4, Feb 4, 2006 IP
  4. ST12

    ST12 Active Member

    Messages:
    1,205
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    90
    #4
    I found one script:

    "<SCRIPT LANGUAGE="JavaScript">
    <!-- Begin

    //Tell-a-friend script
    //Carl Dimmer

    var initialsubj="Hay buddy, take a look at this"
    var initialmsg="Hi:\n You may want to check out this site: "+window.location
    var good;
    function checkEmailAddress(field) {

    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
    if (goodEmail) {
    good = true;
    }
    else {
    alert('Please enter a valid address.');
    field.focus();
    field.select();
    good = false;
    }
    }
    u = window.location;
    function mailThisUrl() {
    good = false
    checkEmailAddress(document.eMailer.email);
    if (good) {

    //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
    window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
    }
    }
    // End -->
    </script>



    <form name="eMailer">
    Tell a friend:
    <input type="text" name="email" size="26" value=" Enter Address Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
    <br>
    <input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
    </form>"


    But it sends the web address plus email at the end like:


    " Hi: You may want to check out this site: http://www.mysite12388.com/e-mail to a friend-.html "


    What do I need changed in the script to have a message


    "Hi: You may want to check out this site: http://www.mysite12388.com/'

    Thank you!
    st12
     
    ST12, Feb 4, 2006 IP
  5. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Not sure about this, try this instead.

    
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    
    //Script by Trånn: http://come.to/tronds
    //Submitted to JavaScript Kit (http://javascriptkit.com)
    //Visit http://javascriptkit.com for this script
    
    var initialsubj="Hay buddy, take a look at this"
    var initialmsg="Hi:\n You may want to check out this site: "+window.location
    var good;
    function checkEmailAddress(field) {
    
    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
    if (goodEmail) {
    good = true;
    }
    else {
    alert('Please enter a valid address.');
    field.focus();
    field.select();
    good = false;
       }
    }
    u = window.location;
    function mailThisUrl() {
    good = false
    checkEmailAddress(document.eMailer.email);
    if (good) {
    
    //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
    window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
       }
    }
    //  End -->
    </script>
    
    
    <form name="eMailer">
    Tell a friend:
    <input type="text" name="email" size="26" value="     Enter Address Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true">
    <br>
    <input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();">
    </form>
    
    Code (markup):
     
    mad4, Feb 4, 2006 IP
  6. ST12

    ST12 Active Member

    Messages:
    1,205
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    90
    #6
    ST12, Feb 4, 2006 IP
  7. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I tested this on my browser with Outlook and it works fine. This suggests there is a problem with how it interacts with your email program.

    This is the problem with using JS to do this (not mentioning the fact that some people with webmail acounts can't use it).

    You really need to try implement a php script to do the job.
     
    mad4, Feb 4, 2006 IP
  8. ST12

    ST12 Active Member

    Messages:
    1,205
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    90
    #8
    mad4 the Java script you gave is not good enough

    the web address comes with /email at the end.

    thank you thogh.


    I'll check the php
     
    ST12, Feb 4, 2006 IP
  9. infonote

    infonote Well-Known Member

    Messages:
    4,032
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    160
    #9
    infonote, Feb 5, 2006 IP
  10. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #10
    TheSyndicate, Jun 20, 2006 IP
  11. jaquille07

    jaquille07 Active Member

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    Digital Goods:
    2
    #11
    Hello,

    I have tested several scripts and Super Tell A Friend PRO seems to be the best.
    You can test it online here:
    http://www.super-tell-a-friend.com

    I hope this helps.
     
    jaquille07, Feb 10, 2013 IP