Solved

Post for Holger

Posted on 1998-06-06
2
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

636 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