<a id ="rnavLink" href ="#" postURL="http://localhost:8080/GE/jsp/PclYxAction.jsp?DATATYPE_OP=&DATATYPE_COND=&DATATYPE_COND2=&DESCRIPTION_OP=&DESCRIPTION_COND=&DESCRIPTION_COND2=&FIELDNAME_OP=&FIELDNAME_COND=&SOURCENAME_OP=&SOURCENAME_COND=&PAGESIZE=10&ENQUIREID=test2&SYS.USERID_COND=null&SYS.PROCESSDATE_COND=null&ORDERBY_CNT=0&FUNCID=0&runbatButton=1" target="_blank">搜索</a>
$(document).ready(function() {
$('#rnavLink').click(function() {
var p = $(this).attr('postURL').split('?');
alert(p);
var action = p[0];
var params = p[1].split('&');
var form = $('<form/>', {action:action, method:'post'}).appendTo('body');
for (var i in params) {
var tmp = params[i].split('=');
var key = tmp[0], value = tmp[1];
$('<input/>', {type:'hidden', name:key, value:value}).appendTo(form);
}
alert(form);
$(form).submit();
return false;
});
});
<script language="Javascript">
$(document).ready(function() {
$("a").each(function (){
var loc = this.href ;
var loc1 ="'"+loc+"'";
// var obj = "submit_form("+loc1+")";
this.href ="###";
loc = decodeURIComponent(loc);
$(this).attr("postURL" , loc);
//$(this).attr("onclick" , obj);
});
$("a").click(function(){
//alert("postURL:"+$(this).attr("postURL"));
var loc = $(this).attr("postURL") ;
//loc = decodeURIComponent (loc);
submit_form(loc );
});
});
function submit_form(loc ){
var framid = "fraRightFrame";
var p = loc.split('?');
var action = p[0] ;
if(p.length>1){
var params = p[1].split('&');
// alert(p);
var form = $('<form/>', {action:action, method:'post' , target:framid}).appendTo('body');
for (var i in params) {
params[i] = trim(params[i]);
var tmp = params[i].split('=');
var key = tmp[0], value = tmp[1];
if(value !=null && value.length>0){
//value =value.replace("%20" ," ");
// alert("key:"+key +"&value:"+value);
//value = encodeURI(value);
$('<input/>', {type:'hidden', name:key, value:value}).appendTo(form);
}
// action = action + "&"+key +"="+value ;
// $('<input/>', {type:'hidden', name:key, value:value}).appendTo(form);
}
}
//action = encodeURI(action);
//alert("action:"+action);
$(form).submit().remove();
}</script>