...

View Full Version : Using a variable for the body in mailto



dragon6158
02-12-2008, 02:15 PM
I am trying to use the following code to send a preformatted email using a variable called email for the body of the email. Can I do this and, if so, how?




<script type="text/javascript">
function findlastip(vlanip1){
var ipoctets = new Array();

if (!/^((0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})\.){3}(0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})$/.test(vlanip1))
{
alert("You must put in a valid IP address!");
document.getElementById("vlanip").focus();
return;
}

ipoctets = vlanip1.split(/\./g);
switch(ipoctets[3]){
case '1':
document.forms.ipinfo.lastip.value=(ipoctets[0] + '.' + ipoctets[1] + '.' + ipoctets[2] + '.127');
return (ipoctets[0] + '.' + ipoctets[1] + '.' + ipoctets[2] + '.127');
break;
case '129':
document.forms.ipinfo.lastip.value=(ipoctets[0] + '.' + ipoctets[1] + '.' + ipoctets[2] + '.254');
return (ipoctets[0] + '.' + ipoctets[1] + '.' + ipoctets[2] + '.254')
break;
default:
alert('VLAN IP must have .1 or .129 as last octet.')
document.getElementById("vlanip").focus();
return;
}
}

function buildmessage(metroid,clliid,loopback,subnetip,lastusable,vlan) {
var message;

lastusable = findlastip(vlan);

message = "Metro=" + metroid + "\n" + "7609 CLLI=" + clliid + "\n" + "7609 LPBK IP=" + loopback + "\n" + "Subnet Address=" + subnetip + "\n" + "7609 Last Usable IP=" + lastusable + "\n" + "7609 Mgmt V-LAN IP Address=" + vlan;
alert(message);
return message;
}

</script>

<form id='ipinfo'>
<p>Metro:</p>
<input type='text' id='metro' onblur='replacevars(this.id,this.value)' />
<p>7609 CLLI:</p>
<input type='text' id='clli' onchange='this.blur()' onblur='replacevars(this.id,this.value)'/>
<p>7609 Loopback IP</p>
<input type='text' id='lpbackip' onchange='this.blur()' onblur='this.value=this.value.toUpperCase();replacevars(this.id,this.value,testREG(/^((0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})\.){3}(0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})$/,this.value))'/>
<p>Subnet Address:</p>
<input type='text' id='subnet' onblur='this.value=this.value.toUpperCase();replacevars(this.id,this.value,testREG(/^((0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})\.){3}(0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})$/,this.value))'/>
<p>7609 Last Usable IP:</p>
<input type='text' id='lastip' onblur='this.value=this.value.toUpperCase();replacevars(this.id,this.value,testREG(/^((0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})\.){3}(0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})$/,this.value))' />
<p>7609 Mgmt VLAN IP Address:</p>
<input type='text' id='vlanip' onchange='this.blur()' onblur='this.value=this.value.toUpperCase();replacevars(this.id,this.value,testREG(/^((0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})\.){3}(0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})$/,this.value));var email;email = buildmessage(document.forms.ipinfo.metro.value,document.forms.ipinfo.clli.value,document.forms.ipinf o.lpbackip.value,document.forms.ipinfo.subnet.value,document.forms.ipinfo.lastip.value,document.form s.ipinfo.vlanip.value);'/>
</form>

<li><a href="mailto:dd0502@att.com?subject=ENOC IP Info&body=email">Notify ATS of Software Problem</a></li>



Thanks for any assistance.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum