开发者

Browser compatible code which take values from hidden field and pass it through query string on to other page

Right now I am using this code on client side.

function winChangeOption()
{
    window.open("../Reports/AdjustedPrincipal_Filter.aspx?schemeid=" + document.getElementById("hfSchemeID").value + "&PropertyRefID=" + document.getElementById("hfPropertyRefID").value + "&DatePart=" + document.getE开发者_JAVA技巧lementById("hfDatePart").value ,"AdjustedPrincipal_Filter","top=150,left=180,height=250,width=600,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=no")
    window.close();
}

The values for the hidden fields are already set. I want these value to open a window, in which the fields will be already filled using the values passed by this page.

This code is working fine on Internet Explorer, but not on other browsers. Moreover, when I don't pass any value and just open the required window, it works on all browsers.

Is there a browser compatible solution for my problem?


I don't know if it's your problem or not, but it looks like you need a semicolon before window.close();

Also, I would recommend changing your code like so:

function winChangeOption()
{
  var hfSchemID = document.getElementById("hfSchemeID").value;
  var hfPropertyRefID = document.getElementById("hfPropertyRefID").value;
  var hfDatePart = document.getElementById("hfDatePart").value;

  window.open("../Reports/AdjustedPrincipal_Filter.aspx?schemeid=" + 
                  hfSchemeID + "&PropertyRefID=" + 
                  hfPropertyRefID + "&DatePart=" + hfDatePart
              ,"AdjustedPrincipal_Filter"
              ,"top=150,left=180,height=250,width=600," + 
                  "location=no,menubar=no,status=no,toolbar=no," + 
                  "scrollbars=no,resizable=no");
  window.close();

}

This will give you the change to see if one of your getElementById calls are failing, which is what I would suspect your problem is.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜