Javascript submit to form submit

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I have been trying to figure this out for a hour now and im hoping someone can give me some assistance. I need to convert the following code to work with a form.

Code:
<script language="JavaScript">
function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
</script>

<a href="javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">Send Email</a>

This is what i have so far.

Code:
      <form name="sample" action="" onsubmit="return newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">
      </form>
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
Well you need a submit button for your form.

Add "<input type="submit" value="Submit" name="subsample" />" to your form (With out the quotes [" "])
 

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I am aware I left that our because I believe there is an error in the way the form is submitting. I use the input below

Code:
<input type="image" name="submit" src="../images/tell.jpg" onmouseover="this.src='../images/tell1.jpg';" onmouseout="this.src='../images/tell.jpg';" border="0" alt="Add to Cart" />
Edit:
I am still unable to figure this out if anyone has any ideas please let me know.
 
Last edited:
Top