码迷,mamicode.com
首页 > 其他好文 > 详细

get改造成post请求

时间:2015-05-07 16:13:45      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
<script type="text/javascript">


function post(url, params) {
    var temp = document.createElement("form");
    temp.action = url;        
    temp.method = "post";        
    temp.style.display = "none";        
    for (var x in params) {        
        var opt = document.createElement("textarea");        
        opt.name = x;        
        opt.value = params[x];        
        temp.appendChild(opt);        
    }        
    document.body.appendChild(temp);        
    temp.submit();        
    return temp;
}

  $("#travelBut").click(function(){
    window.location.href = "javascript:post(‘<%=path%>/main/mainPage_main.action‘,{choice:0})";
  });

</script>
  </head>
  
  <body>
    <div class="con_foot_bg"></div>
<div class="foot">
	<div class="foot_bg"></div>
    <p class="copr">  
		<a href="javascript:;" onclick="javascript:post(‘<%=path%>/main/mainPage_first.action‘)">网站首页</a>|
		<a href="javascript:;" onclick="javascript:post(‘<%=path %>/main/news_list.action‘)">赛事新闻</a>|
		<a href="javascript:;" onclick="javascript:post(‘<%=path %>/main/mainPage_rankList.action‘,{style:‘voteNumber‘})">排行榜</a>|
		<a href="javascript:;" onclick="javascript:post(‘<%=path %>/main/mainPage_works.action‘,{checkFlag:3})">推荐作品</a>|
		<a href="javascript:;" onclick="javascript:post(‘<%=path %>/main/judge_list.action‘)">点评人</a>
		
	</p>
</div>
  </body>
</html>
  

  

get改造成post请求

标签:

原文地址:http://www.cnblogs.com/a757956132/p/4484996.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!