我正在尝试使用python和CGI进行web界面开发。点击网页上的一个按钮应该调用函数从网络设备获取时钟详细信息。在
import sys, os
#importing library files
sh_clk = ""
class test_001(test_case):
def setUp(self):
#Establish a telnet session to the network device.
def tearDown(self):
# Close the telnet session
def test_001(self):
global sh_clk
sh_clk = device("show clock")
if __name__ == '__main__':
print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>First CGI Program</title>'
print '</head>'
print '<body>'
#run_test
print '<h2>'+sh_clk+'</h2><br>'
print '</body>'
print '</html>'
利用以上代码,在网页上打印出以下输出。在
^{pr2}$我想创建一个按钮“显示时钟”,点击它,应该显示时间。无法确定如何实现这一点,下面是缺少函数调用的原始代码。在
print '<form>'
print '<input type="button" value="Open Window" onclick="something missing">'
print '</form>'
print '<h2><div id="sh_clk"></div></h2>'
print '<button onclick="something missing">Show Clock</button>'
如果有人能提出如何满足要求的建议,那将是真正的帮助。在
目前没有回答
相关问题 更多 >
编程相关推荐