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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

must be something very easy... 1

Status
Not open for further replies.

Rydel

Programmer
Feb 5, 2001
376
CZ
...but I can't spot the mistake (did not program anything in JavaScript for more than 6 months, so I guess I forgot some syntax):


<html>
<head>
<title>homepage text generator</title>
<script>
generatePromo() {
document.pf.promo.value = &quot;test&quot;;
}
</script>
</head>
<body>

...
<form name=&quot;pf&quot;>
<p>
<input type=&quot;button&quot; name=&quot;b1&quot; value=&quot;Generate code&quot; onclick=&quot;generatePromo();&quot;>
<input type=&quot;text&quot; name=&quot;promo&quot; size=&quot;20&quot; value=&quot;&quot;>
</p>
</form>

...

It returns an error &quot;object expected&quot;.

regards,
rydel n23
 

Add &quot;
Code:
function
&quot; before your function name. Like:
Code:
function generatePromo() {
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top