2015-07-09 97 views
0

我正在处理我的第一个Web应用程序,我尝试使用JavaScript通过单击文本来提交表单。当我点击文字时,什么都没有发生。现在应该打开一个简单的网页。我知道如何使用html处理表单,但是当我尝试使用JavaScript时,什么也没有发生。我正在使用unix,并且我已经配置了我的服务器和chmod 755 cgi文件。我不是这不是一个服务器错误,因为我之前已经执行了它的CGI文件。我下面这个教程: http://www.thesitewizard.com/archive/textsubmit.shtmlJavaScript文本没有提交表格

这里是我的测试HTML:

<html> 
<head> 
    <title>EDVT Report Generator</title> 
    <style> 
     h1 { 
      text-align: center; 
     } 
     <script language="JavaScript" type="text/javascript"> 

      function getsupport (selectedtype) 
      { 
       document.supportform.supporttype.value = selectedtype ; 
       document.supportform.submit() ; 
      } 

     </script> 
    </style> 
</head> 
<body> 
    <h1 id = "title">Test</h1> 
    <form name="supportform" method="post" action="/cgi-bin/hello.py"> 
     <input type="hidden" name="supporttype" /> 
     <a href="javascript:getsupport('Paid')" onclick = "getsupport('Paid')">Paid Support</a> or 
     <a href="javascript:getsupport('Free')" onclick = "getsupport('Free')">Free Support</a> 
    </form> 
</body> 
</html> 

这里是CGI文件:

#!/usr/bin/python 

import cgitb, cgi 
cgitb.enable() 

print "Content-type:text/html\r\n\r\n" 
print '<html>' 
print '<head>' 
print '<title>Hello Word - First CGI Program</title>' 
print '</head>' 
print '<body>' 
print '<h2>Hello Word! This is my first CGI program</h2>' 
print '</body>' 
print '</html>' 

我在与什么是错误的,因为完全丧失我没有太多的JavaScript经验。任何帮助表示赞赏!

+1

你有''