2013年11月21日星期四

jsp page how hidden inside the same values ??and passed as a parameter ? ? ?

jsp code is as follows :



Requirements Description: how to tel_hidden in inside pass the value in the past ? That is, the "getByID.do? Telnumber =" + tel_hidden inside tel_hidden replaced 's value?
------ Solution ---------------------------------------- ----
/ / refactored code to achieve your needs



------ Solution ----------------------------- ---------------

<head>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        var a = $("#a").attr("herf") + $("#tel_hidden").val();
        alert(a);
    })
</script>
</head>
    
<body>
     <input type="hidden" id="tel_hidden" value="sss" name="tel_hidden"/> 
        <ul>
        <li><a id="a" herf="getByID.do?telnumber="   target="dialog"  cc="true" rel="add"  >welcome</a></li>
        </ul>
</body>

------ Solution ------------------- -------------------------

function linkTo(){
alert(document.getElementById("tel_hidden").value);
window.location="getByID.do?telnumber="+document.getElementById("tel_hidden").value;
}
<a href="javascript:linkTo();">vvvv</a>

------ Solution --------- -----------------------------------
1, url parameter pass in the past ... do? telnumne = ..
2, form form
3, are used struts pins , struts1 struts2 form words with objects or write directly to the inside of the action do not forget to write private String tel_hidden get set method
------ For reference only ---------------------------------------

Thank you, but I want to know is how to place a value as an argument to herf = "getByID.do? telnumber ="? ? ? ?
------ For reference only -------------------------------------- -

Thank you, but I want to know is how to place a value as an argument to herf = "getByID.do? telnumber ="? ? ? ?  

replaced like following

var a = $("#a").attr("herf") + $("#tel_hidden").val();
$("#a").attr("herf", a);
alert($("#a").attr("herf"));

------ For reference only ----------------------------------- ----
Thank u011559804, the problem has been solved. Mainly pick up individual human stinks , do not want to change too much, so directly in the url inside pass in the past .

没有评论:

发表评论