<script type="text/javascript">
var choice1 = "111";
var choice2 = "222";
</script>
方法一:修改a的href属性
<a id="aaa">查看数据</a> 
<script type="text/javascript">
document.getElementById("aaa").href='caxh/down_execgyload?page=1&jgm='+choice1+'&sh='+choice2;
</script>
方法二:用document.write()
<script type="text/javascript">
document.write('<a href=caxh/down_execgyload?page=1&jgm='+choice1+'&sh='+choice2+'>查看数据</a>');

</script>


如下:

<script>
				//var text = document.getElementById('meiquanId').value;
				//alert(text);
				var fu = '';
				function getmeiquanmoney(){
						var id = "<?php echo $id;?>";
						var addinfoid = "<?php echo $addinfo['id'];?>";
						var invoiceid = "<?php echo $invoice['id'];?>";
						var couponsid = "<?php echo $coupons['id'];?>";
						var type = "<?php echo $type;?>";
						var addinfoid = "<?php echo $addinfo['id'];?>";
						

						var text = document.getElementById('meiquanId').value;
						alert(text);

						if(text == '1' ){
							var fu="<?php echo $fu;?>";		
							var str = '<a href=javascript:zhifu(\'index.php?s=/addon/WeiSite/Alipay/index/cartid/'+id+'/addid/'+addinfoid+'/invid/'+invoiceid+'/couponsid/'+couponsid+'/paytype/2/type/'+type+'/fu/'+fu+'\','+addinfoid+')'+'>微信支付</a>';
							document.getElementById('boldStuff2').innerHTML = str;	
						}
						if(text == '0'){
							var fu="<?php echo $yingfu;?>";				
							var str = '<a href=javascript:zhifu(\'index.php?s=/addon/WeiSite/Alipay/index/cartid/'+id+'/addid/'+addinfoid+'/invid/'+invoiceid+'/couponsid/'+couponsid+'/paytype/2/type/'+type+'/fu/'+fu+'\','+addinfoid+')'+'>微信支付</a>';
							document.getElementById('boldStuff2').innerHTML = str;	
						}
						//location.reload();
					}

					
				
					
					document.write('<p id=\'boldStuff2\'>查看数据2</p>');
				
				</script>



本文转载:CSDN博客