今天在做一个简单的页面提交,因为公司用webservice比较多,所以也想往这方面靠,贴上代码: <body>
<h1 align="center">详细描述</h1>
<div id="description" align="center">
<form action="servlet/InfoCollection" method="post">
地址:<input type="text" name="URL" size="50"><br><br>
名称:<input type="text" name="Name" size="50"><br><br>
介绍:<input type="text"" name="Info" size="50"><br><br>
<input type="submit" value="提交"/>
</form>
</div>
</body>在C++里面按钮好像有OnClick事件啊什么的,以前都是type="submit",现在需要调用webservice来做。现在想点击提交按钮用JavaScript调用webservice,该怎么弄啊,希望了解这方面知识的大侠留下参考方法,谢谢大家了。
<h1 align="center">详细描述</h1>
<div id="description" align="center">
<form action="servlet/InfoCollection" method="post">
地址:<input type="text" name="URL" size="50"><br><br>
名称:<input type="text" name="Name" size="50"><br><br>
介绍:<input type="text"" name="Info" size="50"><br><br>
<input type="submit" value="提交"/>
</form>
</div>
</body>在C++里面按钮好像有OnClick事件啊什么的,以前都是type="submit",现在需要调用webservice来做。现在想点击提交按钮用JavaScript调用webservice,该怎么弄啊,希望了解这方面知识的大侠留下参考方法,谢谢大家了。
请楼主参考,这是在aspx页面用js调用webservice的例子,很完整,jsp调用的原理应该是一样的,楼主多试试。
fuction to(){
}
</script> <form action="servlet/InfoCollection" method="post" onsubmit="to()">
地址:<input type="text" name="URL" size="50"><br><br>
名称:<input type="text" name="Name" size="50"><br><br>
介绍:<input type="text"" name="Info" size="50"><br><br>
<input type="submit" value="提交"/> // 点击按钮 调用js中to()方法
</form>
<h1 align="center">详细描述</h1>
<div id="description" align="center">
<form action="servlet/InfoCollection" method="post" onsubmit="方法名()">
地址:<input type="text" name="URL" size="50"><br><br>
名称:<input type="text" name="Name" size="50"><br><br>
介绍:<input type="text"" name="Info" size="50"><br><br>
<input type="submit" value="提交"/>
</form>
</div>
</body>如上加上 onsubmit="方法名()"
若有返回值 onsubmit="return 方法名()"