Solved

Post for Holger

Posted on 1998-06-06
2
200 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

820 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