| | |
How can i get href="mailto.. to work in a function.
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2005
Posts: 19
Reputation:
Solved Threads: 1
I have a form that has specific field layouts that does not use <p <a formats so i need a javascrip function. the href work just great it pops up a client side email form and prefills the "to" and "subject". this is a scheduling form and the user may want to contact the supplier with a email so there are two email fields setup on the form. i tried a button, radio button and used the onsubmit and onradiochanged both give errors function not part of form then I used textbox onchange. that calls the function smail()
i've tried several ways. last one is here. but it come up with two messages first is a form is being submited to email, second is an application is try to send a email. i answer ok to first and yes to second. but system does nothing. I just want it to pop up a new email message window and prefill To: and subject field from e1 or e2 or e1 & e2 textboxes.
here is function sofar.
function smail() {
alert ("mailto:" + document.forms[0].EmailTextbox.value +"?subject=Hi");
var eminfo = "mailto:" + document.forms[0].EmailTextbox.value +"?subject=Hi" ;
document.forms[0].action = eminfo;
document.forms[0].submit();
return ;
}
function smaila() {
alert ("mailto:" + document.forms[0].AltEmailTextbox.value +"?subject=Hi");
var eminfo1 = "mailto:" + document.forms[0].AltEmailTextbox.value +"?subject=Hi" ;
document.forms[0].action = eminfo1;
//document.forms[0].submit();
return false;
}
function smailb() {
alert ("mailto:" + document.forms[0].EmailTextbox.value + "; " + document.forms[0].AltEmailTextbox.value +";?subject=Hi");
var eminfoall = "mailto:" + document.forms[0].EmailTextbox.value + "; " + document.forms[0].AltEmailTextbox.value +";?subject=Hi" ;
document.forms[0].action = eminfoall;
//document.forms[0].submit();
return false;
}
TIA sqlchopper as you may see this is my second script I've tried to write.
i've tried several ways. last one is here. but it come up with two messages first is a form is being submited to email, second is an application is try to send a email. i answer ok to first and yes to second. but system does nothing. I just want it to pop up a new email message window and prefill To: and subject field from e1 or e2 or e1 & e2 textboxes.
here is function sofar.
function smail() {
alert ("mailto:" + document.forms[0].EmailTextbox.value +"?subject=Hi");
var eminfo = "mailto:" + document.forms[0].EmailTextbox.value +"?subject=Hi" ;
document.forms[0].action = eminfo;
document.forms[0].submit();
return ;
}
function smaila() {
alert ("mailto:" + document.forms[0].AltEmailTextbox.value +"?subject=Hi");
var eminfo1 = "mailto:" + document.forms[0].AltEmailTextbox.value +"?subject=Hi" ;
document.forms[0].action = eminfo1;
//document.forms[0].submit();
return false;
}
function smailb() {
alert ("mailto:" + document.forms[0].EmailTextbox.value + "; " + document.forms[0].AltEmailTextbox.value +";?subject=Hi");
var eminfoall = "mailto:" + document.forms[0].EmailTextbox.value + "; " + document.forms[0].AltEmailTextbox.value +";?subject=Hi" ;
document.forms[0].action = eminfoall;
//document.forms[0].submit();
return false;
}
TIA sqlchopper as you may see this is my second script I've tried to write.
•
•
Join Date: Jan 2005
Posts: 19
Reputation:
Solved Threads: 1
•
•
•
•
Originally Posted by tgreer
Please use code tags. Please use English, including proper punctuation, spelling, and grammer, as far as possible.
I personally found your message incomprehensible... what does "used the onsubmit and onradiochanged both give errors function not part of form" mean??
•
•
Join Date: Jan 2005
Posts: 19
Reputation:
Solved Threads: 1
Sorry, this is wordy.
Let me back up. I have developed a Intra company vendor scheduling web system using ms vb.net. On the scheduling form everything uses absolute positioning.
I've just added two texbox for user to record email addresses. Users want to be able to click on something and have the system pop up a email and prefill it with the email infomation in the textbox. They want three options; Send email using addresses from textbox 1, or from textbox 2, or from both textbox 1 and 2.
PROBLEM 1: I need to anchor the 3 new href links in a absolute position on the screen and develope a function to replace the send to info in the href on the fly based on info in textbox.
I first put a button on the form and used the "onClick" to call the function. That try gave me the error "error smail function not part of web page"
I then tried using a radiobutton and used the "onradiochanged" but got the same error.
So I created a small textbox and use the "onblur" event to kick off the function I posted.
Problem 2: How do I modify the 3 new existing href links with the info from the email textbox areas. It seams after reading tons of stuff on the web that I can not use a javascript function to kick off a email. The function with the "action =" and "submit" works but no email come up and whatever was created goes to nevernever land. I thought of using the Form "onload" event to call the function and I would also have to update the links if info is changed.
Let me back up. I have developed a Intra company vendor scheduling web system using ms vb.net. On the scheduling form everything uses absolute positioning.
I've just added two texbox for user to record email addresses. Users want to be able to click on something and have the system pop up a email and prefill it with the email infomation in the textbox. They want three options; Send email using addresses from textbox 1, or from textbox 2, or from both textbox 1 and 2.
PROBLEM 1: I need to anchor the 3 new href links in a absolute position on the screen and develope a function to replace the send to info in the href on the fly based on info in textbox.
I first put a button on the form and used the "onClick" to call the function. That try gave me the error "error smail function not part of web page"
I then tried using a radiobutton and used the "onradiochanged" but got the same error.
So I created a small textbox and use the "onblur" event to kick off the function I posted.
Problem 2: How do I modify the 3 new existing href links with the info from the email textbox areas. It seams after reading tons of stuff on the web that I can not use a javascript function to kick off a email. The function with the "action =" and "submit" works but no email come up and whatever was created goes to nevernever land. I thought of using the Form "onload" event to call the function and I would also have to update the links if info is changed.
•
•
Join Date: Jan 2005
Posts: 19
Reputation:
Solved Threads: 1
resolved. here is code.
[HTML]
// this is javascript source.
datareview.js
function smail() {
smaila();
smailb();
smailc();
return;
}
function smaila() {
var x = document.getElementById('table2').rows[0].cells;
x[0].innerHTML = "<a href=mailto:" + document.forms[0].EmailTextbox.value + "?subject=Hi" + ">Email</a>";
//alert (x[0].innerHTML);
return ;
}
function smailb() {
var x = document.getElementById('table3').rows[0].cells;
x[0].innerHTML = "<a href=mailto:" + document.forms[0].AltEmailTextbox.value +"?subject=Hi" + ">Email</a>";
//alert (x[0].innerHTML);
return ;
}
function smailc() {
var x = document.getElementById('table4').rows[0].cells;
x[0].innerHTML = "<a href=mailto:" + document.forms[0].EmailTextbox.value + "; " + document.forms[0].AltEmailTextbox.value +"?subject=Hi" + ">Email</a>";
//alert (x[0].innerHTML);
return ;
}
function kH(e) {
var pK = e ? e.which : window.event.keyCode;
return pK != 13;
}
// end of datareview.js
<HTML>
<HEAD>
<title>PARSDataReview</title>
<meta content="False" name="vs_snapToGrid">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script src="datareview.js" type="text/javascript"></script>
<script type="text/javascript"><!--
<!-- used to disable the enter key press
document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);
file://-->
</script>
</HEAD>
<body onload="smail()" bgColor="#fff8bb" XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid"
MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<form>
<TABLE id="Table2" style="Z-INDEX: 402; LEFT: 898px; WIDTH: 36px; POSITION: absolute; TOP: 134px; HEIGHT: 27px"
cellSpacing="1" cellPadding="1" width="36" border=0>
<TR>
<TD><a href="mailto:?subject=Hi">Email</a></TD>
</TR>
</TABLE>
<TABLE id=Table3 style="Z-INDEX: 403; LEFT: 899px; WIDTH: 76px; POSITION: absolute; TOP: 181px; HEIGHT: 9px"
cellSpacing=1 cellPadding=1 width=76 border=0>
<TR>
<TD><A href="mailto:?subject=Hi">Email Alt</A></TD>
</TR>
</TABLE>
<TABLE id=Table4 style="Z-INDEX: 406; LEFT: 900px; WIDTH: 76px; POSITION: absolute; TOP: 206px; HEIGHT: 9px"
cellSpacing=1 cellPadding=1 width=76 border=0>
<TR>
<TD><A href="mailto:?subject=Hi">Email Both</A></TD>
</TR>
</TABLE>
</form>
</Body>
</HTML>[/HTML]
[HTML]
// this is javascript source.
datareview.js
function smail() {
smaila();
smailb();
smailc();
return;
}
function smaila() {
var x = document.getElementById('table2').rows[0].cells;
x[0].innerHTML = "<a href=mailto:" + document.forms[0].EmailTextbox.value + "?subject=Hi" + ">Email</a>";
//alert (x[0].innerHTML);
return ;
}
function smailb() {
var x = document.getElementById('table3').rows[0].cells;
x[0].innerHTML = "<a href=mailto:" + document.forms[0].AltEmailTextbox.value +"?subject=Hi" + ">Email</a>";
//alert (x[0].innerHTML);
return ;
}
function smailc() {
var x = document.getElementById('table4').rows[0].cells;
x[0].innerHTML = "<a href=mailto:" + document.forms[0].EmailTextbox.value + "; " + document.forms[0].AltEmailTextbox.value +"?subject=Hi" + ">Email</a>";
//alert (x[0].innerHTML);
return ;
}
function kH(e) {
var pK = e ? e.which : window.event.keyCode;
return pK != 13;
}
// end of datareview.js
<HTML>
<HEAD>
<title>PARSDataReview</title>
<meta content="False" name="vs_snapToGrid">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script src="datareview.js" type="text/javascript"></script>
<script type="text/javascript"><!--
<!-- used to disable the enter key press
document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);
file://-->
</script>
</HEAD>
<body onload="smail()" bgColor="#fff8bb" XMLNS:igtbl="http://schemas.infragistics.com/ASPNET/WebControls/UltraWebGrid"
MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<form>
<TABLE id="Table2" style="Z-INDEX: 402; LEFT: 898px; WIDTH: 36px; POSITION: absolute; TOP: 134px; HEIGHT: 27px"
cellSpacing="1" cellPadding="1" width="36" border=0>
<TR>
<TD><a href="mailto:?subject=Hi">Email</a></TD>
</TR>
</TABLE>
<TABLE id=Table3 style="Z-INDEX: 403; LEFT: 899px; WIDTH: 76px; POSITION: absolute; TOP: 181px; HEIGHT: 9px"
cellSpacing=1 cellPadding=1 width=76 border=0>
<TR>
<TD><A href="mailto:?subject=Hi">Email Alt</A></TD>
</TR>
</TABLE>
<TABLE id=Table4 style="Z-INDEX: 406; LEFT: 900px; WIDTH: 76px; POSITION: absolute; TOP: 206px; HEIGHT: 9px"
cellSpacing=1 cellPadding=1 width=76 border=0>
<TR>
<TD><A href="mailto:?subject=Hi">Email Both</A></TD>
</TR>
</TABLE>
</form>
</Body>
</HTML>[/HTML]
![]() |
Similar Threads
- Matching multiple href="Something.aspx" using RegEx (ASP.NET)
- mac vs windows; help to resolve the problem (HTML and CSS)
- Having trouble passing bool type to function....need help (C++)
- Problems in Dynaform (Form Mail) URGENT HELP (PHP)
Other Threads in the HTML and CSS Forum
- Previous Thread: overflow property isn't working right on Firefox for the mac
- Next Thread: google search form: directions?
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






