...

View Full Version : Javascript not working correctly on firefox



tc2606
07-21-2011, 03:19 AM
Hey guys,

My code works perfectly fine in internet explorer and google chrome, however, in firefox it does not. I have created an online form, but nothing happens when pressing the "submit" button firefox, whereas in other browsers, it works correctly. Also, the centering of the form is different.

Please help me if possible. Thanks


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Airduct Cleaning</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link href="text.css" rel="stylesheet" type="text/css">

<script type="text/JavaScript">
function gosubmit(){

musimw.submit();

}
</script>
<style type="text/css">
#text { width: 250px; position: relative; margin-left: 200px; }
</style>
</head>
<body leftmargin="0" topmargin="0">
<table width="998" heigt="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="147" valign="top">
<!----LEFT MENU--------->
<? include "left_menu.php"; ?>
</td>
<td width="591" valign="top" colspan="1">
<!----TOP--------->
<? include "top.php"; ?>

<!----TITLE--------->
<table width="100%" heigt="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="590" height="33" background="images/top_bg2.gif" valign="bottom"><img src="images/title_sub09_01.gif" /></td>
<td width="1" bgcolor="#d3dfe6"></td>
</tr>
</table>
<!----CONTENT--------->
<!----story------>
<form action=sendmail2.php method=post name=musimw enctype=multipart/form-data onSubmit="return musimm_check(this);">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr style=" position: relative; margin-left: 28px;">
<td width="50"></td>
<td><p><span class="stxt2">Call for a Free Estimate</span><br>
<br>
<img src="images/img25.gif" align="left"><strong>For a free estimate, call:
</strong></p>
<div id="text">
Office: Insert Office #<br />
Toll-Free: Insert Toll Free # <br />
Email: Insert Email<br />
<br><em>Or, submit the online form below.</em>
</div>
</td>
</tr>
<tr>
<td width="50"></td>
<td>
<table width="530" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr>
<td width="10"></td>
<td width="180" height="25">*First name</td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name='fname'/></td>
</tr>
<tr>
<td width="10"></td>
<td width="180" height="25">*Last name</td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name='lname'/></td>
</tr>
<tr>
<td></td>
<td >Phone Number<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name='ptel'/> <select name='pteltype'>
<option value='Home'>Home</option>
<option value='Work'>Work</option>
</select></td>
</tr>
<tr>
<td></td>
<td >Cell Phone Number<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name='ctel'/></td>
</select></td>
</tr>
<tr>
<td></td>
<td height="25">*Email Address</td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name='email'/></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
<tr>
<td width="10"></td>
<td width="180" height="25">*Type of Service</td>
<td style="padding:10px 5px 5px 5px"><select name='bnametype'>
<option value='Air Duct Cleaning'>Air Duct Cleaning</option>
<option value='Dryer Vent Cleaning'>Dryer Vent Cleaning</option>
<option value='Chimney Cleaning'>Chimney Cleaning</option>
</select></td>
</tr>
<tr>
<td></td>
<td height="25">Square Footage<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name='feet'/></td>
</tr>
<tr>
<td></td>
<td height="25">Approximate # of Ducts<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20"name='vent' /></td>
</tr>
<tr>
<td></td>
<td height="25">Number of furnaces</td>
<td style="padding:10px 5px 5px 5px"><select name='furnaces'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
<tr>
<td></td>
<td valign="top" style="padding-top:5px">*Address</td>
<td style="padding:10px 5px 5px 5px"><input type="text" class="inputPlain004" size="30" name='address'></td>
<tr>
<td></td>
<td height="25">*City<br /></td>
<td style="padding:10px 5px 5px 5px"><input name="city" type="text" class="inputPlain004" value="" size="12"></td>
</tr>
<tr>
<td></td>
<td height="25">*State </td>
<td style="padding:10px 5px 5px 5px"><select name='statetype'>
<option value='State'>IL</option></td>
</tr>
<tr>
<td></td>
<td height="25">*Zip Code</td>
<td style="padding:10px 5px 5px 5px"><input name="zip" type="text" class="inputPlain004" value="" size="12"></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
<tr>
<td></td>
<td valign="top" style="padding-top:5px">Comments or Questions</td>
<td style="padding:10px 5px 5px 5px"><textarea name='Comment' cols="45" rows="8"></textarea></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
</table>
<!---BUTTON--->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50" align="center"><a href="javascript:gosubmit()"><img src="images/bt_submit.gif"></a>&nbsp; <a href="#"><img src="images/bt_cancel.gif"></a></td>
</tr>
</table>
</form>
</td>
<td width="1" bgcolor="#d3dfe6"></td>
</tr>
</table>
</td>
<td width="260" valign="top">
<!----RIGHT-------->
<? include "right_menu.php"; ?>
</td>
</tr>
</table>
<!------BOTTOM---------->
<? include "foot.php"; ?>

</body>
</html>

Lerura
07-21-2011, 03:52 AM
Do you really expect us to ask you for a problem to solve. :eek:

If you want help you have to post your code.
Nobody here wants to steal your code, and the solution to your problem, could help others with similar problems.

tc2606
07-21-2011, 04:43 AM
Do you really expect us to ask you for a problem to solve. :eek:

If you want help you have to post your code.
Nobody here wants to steal your code, and the solution to your problem, could help others with similar problems.

You're right. I'll edit my post with it in a minute.

Old Pedant
07-21-2011, 07:38 AM
You are doing

musimw.submit();

and apparently you think that the name musimw is some global.

Yes, it is, in MSIE.

But not in standard JavaScript.

You must use "scope" to find it. To wit:


document.musimw.submit();

or


document.forms["musimw"].submit();

or even

document.forms[0].submit();


However...

You declared your page to be xhtml1-transitional.dtd, and in xhtml, <form> names are deprecated. So, technically, you should change to using

<form id="musimw" ...>

and then do


document.getElementById("musimw").submit();

though the code


document.forms[0].submit();

is correct so long as you know that the <form> in question is the only (or at least first) form on the page.

low tech
07-21-2011, 08:04 AM
Hi

This might move you forward.

I've cleaned up missing quotes spelling etc and changed the submit function

BUT I removed onSubmit="return musimm_check(this);" You can add it back when you include your validation.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Airduct Cleaning</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link href="text.css" rel="stylesheet" type="text/css">

<script type="text/JavaScript">
function gosubmit(){

document.getElementById("musimw").submit();

}
</script>
<style type="text/css">
#text { width: 250px; position: relative; margin-left: 200px; }
</style>
</head>
<body leftmargin="0" topmargin="0">
<table width="998" heigt="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="147" valign="top">
<!----LEFT MENU--------->
<? include "left_menu.php"; ?>
</td>
<td width="591" valign="top" colspan="1">
<!----TOP--------->
<? include "top.php"; ?>

<!----TITLE--------->
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="590" height="33" background="images/top_bg2.gif" valign="bottom"><img src="images/title_sub09_01.gif" /></td>
<td width="1" bgcolor="#d3dfe6"></td>
</tr>
</table>
<!----CONTENT--------->
<!----story------>
<form action="sendmail2.php" method="post" name="musimw" id="musimw" enctype="multipart/form-data" >

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr style=" position: relative; margin-left: 28px;">
<td width="50"></td>
<td><p><span class="stxt2">Call for a Free Estimate</span><br>
<br>
<img src="images/img25.gif" align="left"><strong>For a free estimate, call:
</strong></p>
<div id="text">
Office: Insert Office #<br />
Toll-Free: Insert Toll Free # <br />
Email: Insert Email<br />
<br><em>Or, submit the online form below.</em>
</div>
</td>
</tr>
<tr>
<td width="50"></td>
<td>
<table width="530" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#EFEFEF">
<tr>
<td width="10"></td>
<td width="180" height="25">*First name</td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name="fname" /></td>
</tr>
<tr>
<td width="10"></td>
<td width="180" height="25">*Last name</td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name="lname" /></td>
</tr>
<tr>
<td></td>
<td >Phone Number<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name="ptel" />
<select name="pteltype">
<option value="Home">Home</option>
<option value="Work">Work</option>
</select></td>
</tr>
<tr>
<td></td>
<td >Cell Phone Number<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name="ctel" /></td>
</select></td>
</tr>
<tr>
<td></td>
<td height="25">*Email Address</td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name="email" /></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
<tr>
<td width="10"></td>
<td width="180" height="25">*Type of Service</td>
<td style="padding:10px 5px 5px 5px"><select name="bnametype">
<option value="Air Duct Cleaning">Air Duct Cleaning</option>
<option value="Dryer Vent Cleaning">Dryer Vent Cleaning</option>
<option value="Chimney Cleaning">Chimney Cleaning</option>
</select></td>
</tr>
<tr>
<td></td>
<td height="25">Square Footage<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20" name="feet" /></td>
</tr>
<tr>
<td></td>
<td height="25">Approximate # of Ducts<br /></td>
<td style="padding:10px 5px 5px 5px"><input type="text" size="20"name="vent" /></td>
</tr>
<tr>
<td></td>
<td height="25">Number of furnaces</td>
<td style="padding:10px 5px 5px 5px"><select name="furnaces">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
<tr>
<td></td>
<td valign="top" style="padding-top:5px">*Address</td>
<td style="padding:10px 5px 5px 5px"><input type="text" class="inputPlain004" size="30" name="address"></td>
<tr>
<td></td>
<td height="25">*City<br /></td>
<td style="padding:10px 5px 5px 5px"><input name="city" type="text" class="inputPlain004" value="" size="12"></td>
</tr>
<tr>
<td></td>
<td height="25">*State </td>
<td style="padding:10px 5px 5px 5px"><select name="statetype">
<option value="State">IL</option></td>
</tr>
<tr>
<td></td>
<td height="25">*Zip Code</td>
<td style="padding:10px 5px 5px 5px"><input name="zip" type="text" class="inputPlain004" value="" size="12"></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
<tr>
<td></td>
<td valign="top" style="padding-top:5px">Comments or Questions</td>
<td style="padding:10px 5px 5px 5px"><textarea name="Comment" cols="45" rows="8"></textarea></td>
</tr>
<tr>
<td colspan="3"height="1" background="images/point.gif"></td>
</tr>
</table>
<!---BUTTON--->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50" align="center"><a href="javascript: gosubmit()"><img src="images/bt_submit.gif"></a>&nbsp;<a href="#undefined"><img src="images/bt_cancel.gif"></a></td>
</tr>
</table>
</form>
</td>
<td width="1" bgcolor="#d3dfe6"></td>
</tr>
</table>
</td>
<td width="260" valign="top">
<!----RIGHT-------->
<? include "right_menu.php"; ?>
</td>
</tr>
</table>
<!------BOTTOM---------->
<? include "foot.php"; ?>

</body>
</html>

LT

tc2606
07-21-2011, 08:51 AM
Guys, thank you very very much for your help. The submit works now. The form is a little off center, but I can work on that myself, you guys have helped me a lot.. The main issue is fixed. Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum