Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP created javascript won't load/fire

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
Hi All,

The below is code that is generated through PHP and copied from the browser. In it are two javascript functions that I can't get load/fire correctly...
1.Validate function to validate the form before submission
2.Popup function to act as a sort of tool tip where the use hovers over a link and a window pops up with the option desc.

<td width=&quot;25%&quot;><center><b>Take It</b></td></tr><tr><td><font color=blue><a target=&quot;main&quot; OnMouseOver=&quot;javascript:popup();
return=true&quot; onMouseOut=&quot;javascript:aWindow.close()&quot;;>
Sterilizer</font></a></td><td align = center>$75.00</td>
<td align = center><input type = checkbox name = 2></td></tr></table><tr><td>Quantity</td><td>
<p align =left><input name = quant value = &quot;&quot; type = text size = 3 maxsize = 3>
</td></tr><tr><td>
<input type = submit value = &quot;Add Item to Cart&quot; OnClick=&quot;javascript:validate();&quot;>
<input type = reset value =&quot;Clear&quot;></form></td></tr></table></td></tr></table><br></body>
<script language=&quot;javascript&quot;>
<!--


function validate()
{
if document.form.quant.value > 0 {
alert(&quot;Please specify quantity of Estuary to purchase&quot;);
return false;
}
if document.form.bodyColour.value = &quot;&quot; {
alert(&quot;Please choose a Body Color for the Estuary&quot;);
return false;
}
if document.form.baseColour.value = &quot;&quot; {
alert(&quot;Please choose a Base Color for the Estuary&quot;);
return false;
}
}

function popup()
{ var aWindow;
aWindow = window.open(&quot;&quot;,&quot;&quot;,&quot;directories=no, scrollbars=no, resizable=no, status=no, left=450, top=350, toolbar=no, menu=no, width=125, height=100&quot;);,
}

-->
</script>

</html>

can anyone figure out why this does not work...it is probably basic but I am lost..

TIA Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
try to put var aWindow;

outside all functions.

Probably aWindow is being a local var of the function. Probably this is your problem.
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top