Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Modify script

  1. #1
    Join Date
    Aug 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Modify script

    Hi Guys,
    I have the following script from www.javascripts.internet.com (Copyright acknowledged) which I would like to modify:

    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    function mailsome1(){
    who=prompt("Enter recipient's email address: ","antispammer@earthling.net");
    what=prompt("Enter the subject: ","none");
    if (confirm("Are you sure you want to mail "+who+" with the subject of "+what+"?")==true){
    parent.location.href='mailto:'+who+'?subject='+what+'';
    }
    }
    // End -->
    </SCRIPT>

    <!-- STEP TWO: Copy this code into the BODY of your HTML document -->

    <BODY>

    <CENTER>
    <a href='javascript:mailsome1()'>E-Mail Someone!</a>
    <FORM>
    <input type=button value="E-Mail Someone!" onClick="mailsome1()">
    </FORM>
    </CENTER>

    <p><center>
    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>

    <!-- Script Size: 1.02 KB -->

    As you can see, in the above script, the user is free to write any email address or anything on the form. I would like to modify the mode of entry (from textarea) into "dropdown" method i.e. user select the email addresses and the subject matters from a dropdown list. Can anybody here help me to modify the script.
    Another thing is that, is it also possible to make a dropdown selection for the body of the email (i.e. user select the body/content of their email from a dropdown selection).

    Thank you

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Not really worth it as, this script only calls the user's configured email client (if any). Once that happens, the user can change anything about the message to whatever he or she wishes.

    A server side mail form from your host or third party server side mail form should be used. What exactly is this for?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    You don't need to keep the copyright notice.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by tech_support
    You don't need to keep the copyright notice.
    Let's not start encouraging folks to drop that. Even if that particular site doesn't require it, (which I know nothing about - one way or the other) it is a nice courtesy to include it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    It doesn't state something like 'This notice must stay intact for legal use' so I guess it's perfectly legal to use it without credit.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by tech_support
    It doesn't state something like 'This notice must stay intact for legal use' so I guess it's perfectly legal to use it without credit.
    Not really, you would have to go to the site and read their use policy, if any, to determine that. Don't just assume because it isn't on the notice itself that it isn't a part of the site's use policy. Also, even if it isn't required, it is still a courtesy to include it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    After browsing the site, I got to this:

    Quote Originally Posted by http://javascript.internet.com/faq/
    Yes, we offer our site as a free "public service" resource. Simply stated, all the scripts on this site are free for personal or business use. The only requirement for use of archives is that you leave the credit information inside the script. We also don't think it's too much to ask if you would please link back to The JavaScript Source site to help spread the word about our site. The address for linking to The JavaScript Source is:

    http://javascript.internet.com

    Thanks! And, more information about linking to us is available at:

    http://javascript.internet.com/link-us.html
    Ok. Sorry 'bout that
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  8. #8
    Join Date
    Aug 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It doesn't really matter that user can change the subject matter or body of the email as most of the "users" are my students (btw, I am a teacher). I intend to put it on my website for our convenience, for example, they may send an email to confirm that they have send in their assignments or to request for extension of time to submit their assignment or to request to change classes or join another class.
    Is it possible to modify the script? Pls help me.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <form action="#" method="post">
    <select onchange="if(this.selectedIndex>0){this.form.action='mailto:someone@some.com?subject='+this.options[this.selectedIndex].value;this.form.submit();}">
    <option selected value="">Select</option>
    <option value="Homework">Homework</option>
    <option value="Assignment">Assignment</option>
    </select>
    </form>
    Substitute your email address for the red place holder. The green value attributes become the subject. You can use 'text' instead of 'value' here:

    Code:
    subject='+this.options[this.selectedIndex].value;
    And the subject will be the text that is shown. This eliminates the need to write everything twice as the value attributes can then be dropped. But, you might want one thing as the selection and another as the subject, in which case retain the value attribute and syntax as is.

    This all could be done more simply, without even javascript:

    HTML Code:
    <form action="mailto:someone@some.com">
    <select name="subject">
    <option selected value="">Select</option>
    <option value="Homework">Homework</option>
    <option value="Assignment">Assignment</option>
    </select><br>
    <input type="submit" value="submit">
    </form>
    But, Opera will not use the subject (IE and FF were fine with this though, if using OE) and you could end up with the subject as 'Select' in any browser.

    I still think a server side solution (as I mentioned before, they are not hard to set up) would be better as, even with no mail client configured, your students could still send the mail. This may be more common than you think what with so many younger folks using hotmail and yahoomail, etc. These type of web based email services do not require (or in most cases allow) one to use a configured email client. As a result, many folks who use them do not bother to configure an email client or, they are using someone else's computer that has an email client setup but, for the owner of the computer, not for them. Computers in libraries typically have no email client configured.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Mar 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John,
    I maintain a web site on the 'free' web space that is made available by the cable supplier. They don't have CGI or PHP available to use for server side email... is it possible to still use a server side email application in these circumstances? If not, can you recommend another approach - or other free sites that might be used?
    Allan

Bookmarks

Posting Permissions

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