在新窗口或标签中打开

时间:2014-03-08 05:46:09

标签: javascript winforms parent-child parent

我想在新窗口或标签中打开以下内容。目前它在同一窗口中打开,以便在发送电子邮件后,必须重新加载页面。这是this webpage

的一部分
function email_message()
{
   bodytext = document.getElementById("end").value;

   if (bodytext.length > 1850)
   {
      alert("Oops!  The E-Mail Someone button can only be used for short messages, 3 or    less lines of message text.  \nYou can always copy the Encoded Message and past into your regular email!")
      return;
   }
   who_to = prompt("Enter recipient's email address: ","anybody@anywhere.com");
   s_line = "Encoded Message";

   var confirm_send = confirm("Send Email?");
   if (confirm_send == true)
   {
      parent.location.href = 'mailto:' + who_to + '?subject=' + s_line + '&body=' + "Decode at www.mysite.com/myhtml.htm%0D%0D" + bodytext;
   }
   else
   {
   return;
   }
}

1 个答案:

答案 0 :(得分:1)

使用window.open

您只需要下面的代码在新窗口中打开页面,试过这个

window.open(url, '_blank');