Solved

Post for Holger

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
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)

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now