Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Post for Holger

Posted on 1998-06-06
2
Medium Priority
?
214 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 200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

688 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