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

    email subject composed

    Iím just beginning with JS and am already fanatic. But due to lack of experience I have a problem with pre-defining the subjectrule in an email.

    What Iím trying to do is the following ÖÖ..

    In html you use this code to open an e-mail with predefined subject. (The choise to whom is open, because here Iíll use the selection that is provided by outlook once the e-mail opens. I make a selection out of an adressbook.).

    <a href="mailto:?subject= ???????????????????????????????">IMAGE</a>

    ??????????????????????????????? is composed of the following elements:

    XXXXXX - and ?????? ?????? and - MMMMMMMMMMM ( ).

    XXXXXX - and - MMMMMMMMMMM ( ). are already in the subject rule.

    XXXXXX - at the beginning of the subjectrule and - MMMMMMMMMMM ( ) at the end.

    ?????? ?????? is a selection out of a list (can be one word or a sentence). This selection is enclosed by XXXXXX - and - MMMMMMMMMMM ( ) .

    What should I do so that everything comes together when the e-mail opens to indicate the recipient?

    Something like following code (?????)

    <a href="mailto:?subject= XXXXXX - {select a word or sentence out of a list} - MMMMMMMMMMM ( ) ">IMAGE</a>

    Which script should I use to select a word or sentence out of a list and when selected, this selection should place itself between the 2 already defined XXXXXX - and - MMMMMMMMMMM ().

    Should it be better to use PHP to obtain that list from the server and then use JavaScript? Or is this something stupid to mention???

    Is there please somebody who can help me??

    Thanks a lot in advance.

    Jef Gees
    e-mail: jefgees@westbrabant.net

  2. #2
    New Coder
    Join Date
    Jun 2002
    London & Oxford
    Thanked 0 Times in 0 Posts
    What you are trying to acheive ideally needs to be done by reloading the page so that the values can be hard-coded into the HTML at run time. Having said that, you can achieve a similar effect using DHTML to write your mailto link into a <div> without reloading the page. Bear in mind that this will only work in browsers such as IE5, NS6 and upwards. You could also add a little patch to get it to work in IE4 if needed. Have a play with my example, I hope it furthers your understanding.

    <title>Changing a mailto: link using DHTML</title>
    function changeMailto(i){
    mailtoString = "<a href=\"mailto:person@domain.com?subject=XXXXXX - "+i+" - MMMMMMMMMMM ( )\">IMAGE</a>";
    document.getElementById('test').innerHTML = mailtoString;

    <select onchange="changeMailto(this.options[this.selectedIndex].value)">
    <option value="apples">apples</option>
    <option value="oranges">oranges</option>
    <option value="bananas">bananas</option>

    <br />

    <div name="test" id="test"></div>

    As easy as 3.1415926535897932384626433832795028841


Posting Permissions

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