Thanks but I am having trouble structuring it correctly because of
where the script is/isn't. Yes, I meant javascript. Here is a
portion of my page:
Note: getvalue function gets the value of 'fullname' out of the url
and works fine.
I am confused.
You have this "comment" (It isn't an HTML comment as such - this would need
to be enclosed in said:
// how do I get getvalue("fullname") into the above results?
My question is where do you want to place getvalue("fullname") ?
Do you want it in "MissingEmail"?
I notice this code:
<form method="POST" name="Contact Us" action="--WEBBOT-SELF--"
onSubmit="location.href='_derived/nortbots.htm';return false;" webbot-
onSubmit="return checkform(this);">
As far as I can tell (and I use
http://www.w3schools.com/ as my reference)
this code does this when Submit is pressed:
First execute the javascript after onSubmit=
Then call the ASP file named after action= (which is NOT a file)
I have no idea what it does with webbot-onsubmit=
So what I oginally wrote was simpler code that inserts a value into the
form.
I have now enclosed some code adapted from yours. For testing, I needed a
value for the variable value, so I hard coded it to "(e-mail address removed)". The
next line places the value of value into the form. (Note that the variable
name "value" is not a good choice, but it does work.)
Because getValue() needs to be executed, I added onload ="getValue()" to the
body tag. Does it need to be executed somewhere else?
I understand that you don't want to send the contents of the form to an ASP
file, so I don't have an method="POST", but instead I have
<form name="form1" action="" onsubmit="doit()">
You will need to write the function named doit() to do what you want with
the contents of the form. If it is to send an email back to yourself, this
can be done, using the viewer's installed email client. I have written this
code in doit().
Am I on the right track for what you want ?
If not, please give me more info.
Code follows
<html>
<head>
<title>Test Form</title>
<script type="text/javascript">
function getValue(varname) {
/* rest of the function is here */
/* this line for testing only */
var value = "(e-mail address removed)";
document.form1.MissingEmail.value=value;
}
function doit() {
var subject = "Response from my page"
var body = "The sender's email was "
location.href='mailto:
[email protected]'
+ '?subject=' + subject
+ '&body=' + body + document.form1.MissingEmail.value
}
</script>
</head>
<body onload="getValue()">
<form name="form1" action="" onsubmit="doit()">
<p>Here is their email address
<input name="MissingEmail" size="40"></p>
<p>Enter their email address again to confirm
<input name="EmailConfirm" size="40"></p>
<p>MY name is<input name="SenderName" size="40"></p>
<p>MY email address is<input name="replyemail" size="40"></p>
<p><input type="submit" value="Submit" name="submit"></p>
</form>
</body>
</html>