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

Incorporating Javascript in CGI

Status
Not open for further replies.

Albuckj2

Programmer
Jan 7, 2003
68
GB
I need my script below (it's within a CGI program) to work in Netscape Navigator, and for some reason the javascript doesn't work - I click on one of the icons on the left ("Inbox", "Box2" or "Trash"), and it does nothing, whereas in IE the function "GoTo" is called and an alert box is shown (followed by submission of the form).

Someone suggested putting <!-- and --> round my javascript code, but this caused it not to work in either IE or NN!

The code is below. Thanks for any help.

print &quot;<html>&quot;;
print &quot;<head><title> Webmail table </title>&quot;;
print &quot;<SCRIPT LANGUAGE='JavaScript'>&quot;;
#print &quot;<!--&quot;;
print &quot;var temp = 'inbox';&quot;;
print &quot;var temp2 = 'box2';&quot;;
print &quot;var temp3 = 'trash';&quot;;
print &quot;function goto(to)&quot;;
print &quot;{ alert('get there'); document.mailform.box.value = to; document.mailform.submit(); }&quot;;
print &quot;function del()&quot;;
print &quot;{ document.mailform.delmove.value = 'del'; document.mailform.submit(); }&quot;;
#print &quot; -->&quot;;
print &quot;</script>&quot;;
print &quot;</head>&quot;;
print &quot;<body>&quot;;
print &quot;<form name='mailform' action='/~cs91aj/mail.cgi' method='Post'>&quot;;
print &quot;<input type='hidden' name='name' value='yes'>&quot;;
print &quot;<input type='hidden' name='pass' value='yes'>&quot;;
print &quot;<input type='hidden' name='box' value='$box'>&quot;;
print &quot;<input type='hidden' name='delmove' value='none'>&quot;;
print &quot;<table border=0><tr><td valign='top'>&quot;;
print &quot;<table border=0>&quot;;
print &quot;<tr><td><a href='javascript:goto(temp);'>Inbox</a></td></tr>&quot;;
print &quot;<tr><td><a href='javascript:goto(temp2);'>Box2</a></td></tr>&quot;;
print &quot;<tr><td><a href='javascript:goto(temp3);'>Trash</a></td></tr>&quot;;
print &quot;</table></td><td>&quot;;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top