繁体   English   中英

在新视窗或分页中开启

[英]Open in new window or tab

我想在新窗口或标签中打开以下内容。 当前,它在同一窗口中打开,因此在发送电子邮件之后,必须重新加载页面。 这是此网页的一部分

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;
   }
}

使用window.open

您只需要以下代码即可在新窗口中打开页面,请尝试此操作

window.open(url, '_blank');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM