...

View Full Version : Question with Javascript Emailing



coldmail590
11-16-2010, 11:47 PM
Hello everyone, I have a question regarding the following code. What does

a href="javascript:mailsent();

do? I am completely new to web design!

I am trying to create a contact form and found one I liked at http://www.moozedesign.com/

But I am confused about how it works. From most tutorials online, they use PHP and this one doesn't seem to.




<div id="contForm">
<div id="fDiv"><form method="POST" name="form1">
<ul>
<li><input type="text" class="input-main"
name="Name" /></li>
<li><input type="text" class="input-main" name="Company" /></li>
<li><input type="text" class="input-main" name="Email" /></li>
<li><input type="text" class="input-main" name="Mobile" /></li>
<li class="forTA"><textarea class="textarea-main" cols="100" rows="3" name="Comments"></textarea></li>
</ul></form>
</div>
<div style="clear:both"></div>
<div id="subForm"><a href="javascript:mailsent();"></a></div>
<div style="clear:right"></div>
</div>


Here are the fDiv css which contains the text boxes to fill out


#fDiv{
width:670px;
margin-top:5px;
float:right;
background:url(../images/form_bg.png) top left no-repeat;
}

#fDiv ul{
padding-left:140px;
padding-top:20px;
list-style:none;
}

#fDiv ul li{
width:465px;
text-align:center
}

#fDiv ul li .input-main{
background:url(../images/input_n.png) center no-repeat;
padding-left:18px;
padding-right:18px;
height:46px;
width:440px;
border:none;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
line-height:40px;
}

#fDiv ul li .input-main-h{
background:url(../images/input_o.png) center no-repeat;
padding-left:18px;
padding-right:18px;
height:46px;
width:440px;
border:none;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
line-height:40px;
}

.forTA{
height:100px;
width:465px;
padding-left:7px;
padding-right:18px;
padding-top:10px;
background:url(../images/textarea_n.png) no-repeat scroll 7px 0 transparent;

}

.forhTA{
height:100px;
width:465px;
padding-left:7px;
padding-right:18px;
padding-top:10px;
background:url(../images/textarea_o.png) no-repeat scroll 7px 0 transparent;

}

#fDiv ul li .textarea-main{

font-family:Arial, Helvetica, sans-serif;
font-size:12px;
background-color:transparent;
line-height:18px;
height:76px;
width:440px;
border:none;
overflow:hidden;
padding:0px;
}

#fDiv ul li .textarea-main-h{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
background-color:transparent;
line-height:18px;
height:76px;
width:440px;
border:none;
overflow:hidden;
padding:0px;
}



Here is the subForm css which contains the image for the submit button




#subForm{
background:url(../images/submitBtn.png) top left no-repeat;
width:100px;
height:30px;
display:block;
float:right;
margin-right:60px;
margin-bottom:40px;

}


Thank you very much for your help!

harbingerOTV
11-17-2010, 02:52 PM
the function they use:


function mailsent() {
document.form1.action="index.php?act=sent#mContact";
document.form1.submit();
}

so the form submits to the same page, tosses in a variable and a jump link back to the form.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum