Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    48
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Javascript Formatting

    I can't figure out how to properly format the code below. I am looking to add breaks after where it says below. Also to change the color if possible.

    Any help would be much appreciated.


    function isPPC() {
    if (navigator.appVersion.indexOf("PPC") != -1) return true;
    else return false;
    }
    if(isPPC()) {
    document.write('<b>Send <A CLASS="contact" HREF=\"mailto:\?subject\=ADD A BREAK AFTER THIS ' + document.title + '?body= ADD A BREAK AFTER THIS ' + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend</b>');
    }
    else { document.write('<b>Send <A CLASS="contact" HREF=\"mailto:\?body\=ADD A BREAK AFTER THIS ' + document.title + ' ADD A BREAK AFTER THIS ' + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend</b>');
    }

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,195
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Using mailto: is really *not* a good idea. First of all, it only works if the user has a link to his mail client set up from the browser. Some browsers don't support it and in any case nobody using web-based email will be able to use it. Secondly, it means that the user must approve the mail send before it happens, and many people are suspicious of approving anything like that and will click "No."

    MUCH better is to use server-based mail senders. PHP or ASP or JSP or CGI. Most ISP's include a "form mailer" just for this purpose: You just create a <form> and specify that the action= is the PHP/ASP/CGI form mailer and presto, it works.

    You really should check with your ISP to see if they offer one.

    Also, if the form mailer supports it, you may be able to use HTML in your email, so you could then use colors, etc.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Wayniac (11-16-2009)

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    Quote Originally Posted by Old Pedant View Post
    Using mailto: is really *not* a good idea. First of all, it only works if the user has a link to his mail client set up from the browser. Some browsers don't support it and in any case nobody using web-based email will be able to use it. .
    not true anymore; check into custom protocols
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,195
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Ummm...and what about MSIE and Safari users??

    When I use MSIE on my machine, just for example, mailto: does *NOT* work.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    Quote Originally Posted by Old Pedant View Post
    Ummm...and what about MSIE and Safari users??

    When I use MSIE on my machine, just for example, mailto: does *NOT* work.
    sorry bout that, was referring specifically to:
    Quote Originally Posted by Old Pedant View Post
    nobody using web-based email will be able to use it.
    that said, its an HTML5 thing, so i'll bet "the other" browsers catch up soon...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,195
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Yeah, I think it's about time for this protocol stuff. HOWEVER...

    However, it still means you have to have *something* on the server to handle the submittal, and so it seems to me that using one of the more or less standard form mailers for PHP/ASP/JSP/CGI and just changing the action= of the <form> does exactly the same thing and requires essentially the same backend processing, so why not use that and have it compatible with all browsers right now, instantly.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New Coder
    Join Date
    May 2009
    Posts
    48
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thank you all for your help!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •