Javascript 如何将http node.js中res.writehead中的警报消息附加到res.writehead(301,{quot;Location";:";/path/in/site";})? res.writeHead(301,“+ "" + "" + "" + “你好,蒙多”+ "" + "" + “警报(‘完成’)”+ “+”,{“位置”:http://localhost:8086/uploadform" });

Javascript 如何将http node.js中res.writehead中的警报消息附加到res.writehead(301,{quot;Location";:";/path/in/site";})? res.writeHead(301,“+ "" + "" + "" + “你好,蒙多”+ "" + "" + “警报(‘完成’)”+ “+”,{“位置”:http://localhost:8086/uploadform" });,javascript,html,css,node.js,http,Javascript,Html,Css,Node.js,Http,它不显示警报消息并直接重定向到给定链接,我希望警报消息先重定向到给定链接。如果您真的想这样做,可以将所有内容封装在脚本中,如下所示: res.writeHead(301, "<!DOCTYPE html>" + "<html lang='en' dir='ltr'>" + "<head>" + "<met charset='utf-8'>" + "<title>

它不显示警报消息并直接重定向到给定链接,我希望警报消息先重定向到给定链接。

如果您真的想这样做,可以将所有内容封装在脚本中,如下所示:

      res.writeHead(301,  "<!DOCTYPE html>" +
      "<html lang='en' dir='ltr'>" +
      "<head>" +
         "<met charset='utf-8'>" +
          "<title>Hola Mundo</title>" +
        "</head>" +
       "<body>" +
         "<script type='text/javascript'>alert('DOne')</script>" +
     "</body>" +  "</html>", { "Location": "http://localhost:8086/uploadform" });
res.writeHead(301,“+
"" +
"" +
"" +
“你好,蒙多”+
"" +
"" +
“document.onreadystatechange=function(){alert('DOne')}”+
“+”,{“位置”:http://localhost:8086/uploadform" });

有人能帮我吗?
 res.writeHead(301,  "<!DOCTYPE html>" +
  "<html lang='en' dir='ltr'>" +
  "<head>" +
     "<met charset='utf-8'>" +
      "<title>Hola Mundo</title>" +
    "</head>" +
   "<body>" +
     "<script type='text/javascript'>document.onreadystatechange=function(){alert('DOne')}</script>" +
 "</body>" +  "</html>", { "Location": "http://localhost:8086/uploadform" });