Solved

Post for Holger

Posted on 1998-06-06
2
199 Views
Last Modified: 2010-04-09
I wanted to give you both the points after all you  finally solved my problem. Since I can't maybe I'll
ask you a (hopefully) easy question. Thanks for pointing out my errors on the code. I do have 2 html books
but they never seem to be able to answer my questions. It's easy to be sloppy when you are new!

Anyway I have a form that has a typing area in it. When the submit button is depressed I want it to fire the
text off to an email address. Is this easy?  I'll show you the code. I dont get any java script error messages
or anything but it also doesn't go anywhere

<HEAD>
<script language="JavaScript">


bV=parseInt(navigator.appVersion); browser=false; ie3=false; ie4=false; ns4=false;
if (navigator.appName== "Netscape") { if (bV>=4){browser=true; ns4=true;}} else {if (bV>=4){ie4=true; browser=true; } else { if (bV==3) {ie3=true;}}}

pics=new Array(); oC=0; sCo=0;
function bpreload(n,f) {if (browser) {pics[oC]=new Array(4);pics[oC][0]=new Image();pics[oC][0].src=f+".gif";pics[oC][1]=new Image();pics[oC][1].src=f+"h.gif";pics[oC][2]=new Image();pics[oC][2].src=f+"a.gif";pics[oC][3]=n;oC ++; }}
function on(co){ if (browser) {for (var i = 0; i <= oC; i++) { if (pics[i][3]==co){document.images[pics[i][3]].src=pics[i][1].src; sCo=i; i=oC;}}} }
function off(){if (browser) {document.images[pics[sCo][3]].src = pics[sCo][0].src; }}

function click(co)
{
 if (browser) {
        for (var i = 0; i <= oC; i++) {
                if (pics[i][3]==co)
                {
                       
                        if (navigator.appName!="Netscape"){document.anchors(pics[i][3]).blur();}
                       
                        document.images[pics[i][3]].src=pics[i][2].src;
                       
                        t=setTimeout('off()', 700);
                       
                        sCo=i; i=oC;

                }
        }
 }
 
 
if (document.forms[0].elements[0].checked) location.href="jsmith@abc.com"

}

bpreload ("b1","submit");

</script>
</HEAD>
<BODY BGCOLOR="black" Text=silver LINK=gold ALINK=gold VLINK=gold>

<br><br>
<font face=Arial size=3 color=#E0E0E0><blockquote>
<H2>To Mark Jagg</H2><br><br><br><br>

<form action="" method="post">
    <b>If You are an Individual <br>Please Send Us Your Comments or Questions:<br><br>
    <textarea  name="text"  rows="7" cols=45></textarea><br><br>
    <a name=b1 href=javascript:click('b1') onmouseover="on('b1');" onmouseout="off();"><img src=submit.gif align=middle border=0 name=b1></a>
</form>
       
</table>


</BODY>
</HTML>
0
Comment
Question by:ablogan
2 Comments
 
LVL 6

Accepted Solution

by:
Holger101497 earned 50 total points
ID: 1844119
Yes. This is reasonably easy :-)
How should your form know where to send the mail? You have to specify the address as "action".

BTW:
1) if (document.forms[0].elements[0].checked) location.href="jsmith@abc.com" ...
elements[0] is your textarea!! Was is this line supposed to do?? A textarea can't be checked! I'm surprised you don't get an error message along the lines of "undefined" or "document.forms[0].elements[0] does not have a property checked"...
2) You shouldn't Cut&Copy too much! You close a table without ever opening one!
3) Where do you close your <BLOCKQUOTE>?

Well, whatever.

Here's a nice answer to THIS question (mailto):

    <form action="mailto:yourmail@somewhere.net" method=post  ENCTYPE="multipart/form-data">
      <input type=text name="subject" value="Test2postform-data"><BR>
      <textarea COLS=40 ROWS=10 name="body">Testbody</textarea>
      <input type=submit>
    </form>

You can play around with the combinations of ENCTYPE and METHOD to get what you want. If you specify GET and no enctype, the browser opens an e-mail form that the user can still edit. If you specify POST, the form is sent without further user-interaction.
ENCTYPE="multipart/form-data" will encode each form-element as a separate attachment while the "standard" encoding just garbles it into one long string. Just try which one you like best. Either way you can specify a subject-line for these mails by entering "mailto:youraddress@server.com?subject=MySubject" as ACTION.

Hope that's all you need. If it isn't, just ask.

Good luck!
0
 

Author Comment

by:ablogan
ID: 1844120
Thanks Holger...

Sorry I took so long getting back Thanks for the help!
Al
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Find out what you should include to make the best professional email signature for your organization.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: blockā€¦
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question