The Solution of JS in Chrome Browser the Return Value of showModalDialog Function is undefined

  • 2021-07-07 06:29:41
  • OfStack

In this paper, an example is given to describe the solution that the return value of showModalDialog function in Chrome browser is undefined. Share it for your reference, as follows:

Main page:


<script type="text/javascript">
function SelectGroupCust() {
  var temp = window.showModalDialog("Default2.aspx?xx=" + Date(), "", "dialogWidth=800px;dialogHeight=600px;help=no;center=yes;");
  //for chrome
  if (temp == undefined) {
    temp = window.returnValue;
  }
  alert(temp);
  return true;
}
</script>

Details page:


<script language="javascript" type="text/javascript">
function ReturnAddressee() {
  if (window.opener != undefined) {
    window.opener.returnValue = "1";
  }
  else {
    window.returnValue = "2";
  }
  window.close();
}
</script>

For more readers interested in JavaScript related content, please check the topics of this site: "Summary of JavaScript Errors and Debugging Skills", "Summary of JavaScript Mathematical Operation Usage", "Summary of json Operation Skills in JavaScript", "Summary of JavaScript Switching Special Effects and Skills", "Summary of JavaScript Search Algorithm Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Data Structure and Algorithm Skills" and "Summary of JavaScript Traversal Algorithm and Skills"

I hope this article is helpful to everyone's JavaScript programming.


Related articles: