javascript中的windows.alert()命令

时间:2017-08-31 20:34:57

标签: javascript html alert

我正在尝试制作一个Rickroll,并将其发布到我的网站上,但我很早就难过了,我尝试了各种方法来实现这一点,但它不会......任何人都可以发现我的问题。我对javascript并不擅长,而其他simaler问题的解决方案太个人化了。

<!DOCTYPE HTML>
<html>
  <title=You Got RickRolled>
  <script>
  windows.alert("We're no strangers to love");
  windows.alert("You know the rules and so do I");
  windows.alert("A full commitment's what I'm thinking of");
  windows.alert("You wouldn't get this from any other guy");
  windows.alert("I just wanna tell you how I'm feeling");
  windows.alert("Gotta make you understand");
  windows.alert("Never gonna give you up");
  windows.alert("Never gonna let you down");
  windows.alert("Never gonna run around and desert you");
  windows.alert("Never gonna make you cry");
  windows.alert("Never gonna say goodbye");
  windows.alert("Never gonna tell a lie and hurt you");
  windows.alert("We've known each other for so long");
  windows.alert("Your heart's been aching, but");
  windows.alert("You're too shy to say it");
  windows.alert("Inside, we both know what's been going on");
  windows.alert("We know the game and we're gonna play it");
  windows.alert("And if you ask me how I'm feeling");
  windows.alert("Don't tell me you're too blind to see");
  windows.alert("Never gonna give you up");
  windows.alert("Never gonna let you down");
  windows.alert("Never gonna run around and desert you");
  windows.alert("Never gonna make you cry");
  windows.alert("Never gonna say goodbye");
  windows.alert("Never gonna tell a lie and hurt you");
  windows.alert("Never gonna give you up");
  windows.alert("Never gonna let you down");
  windows.alert("Never gonna run around and desert you");
  windows.alert("Never gonna make you cry");
  windows.alert("Never gonna say goodbye");
  windows.alert("Never gonna tell a lie and hurt you");
  windows.alert("(Ooh, give you up)");
  windows.alert("(Ooh, give you up)");
  windows.alert("Never gonna give, never gonna give");
  windows.alert("(Give you up)");
  windows.alert("Never gonna give, never gonna give");
  windows.alert("(Give you up)");
  windows.alert("We've known each other for so long");
  windows.alert("Your heart's been aching, but");
  windows.alert("You're too shy to say it");
  windows.alert("Inside, we both know what's been going on");
  windows.alert("We know the game and we're gonna play it");
  windows.alert("I just wanna tell you how I'm feeling");
  windows.alert("Gotta make you understand");
  windows.alert("Never gonna give you up");
  windows.alert("Never gonna let you down");
  windows.alert("Never gonna run around and desert you");
  windows.alert("Never gonna make you cry");
  windows.alert("Never gonna say goodbye");
  windows.alert("Never gonna tell a lie and hurt you");
  windows.alert("Never gonna give you up");
  windows.alert("Never gonna let you down");
  windows.alert("Never gonna run around and desert you");
  windows.alert("Never gonna make you cry");
  windows.alert("Never gonna say goodbye");
  windows.alert("Never gonna tell a lie and hurt you");
  windows.alert("Never gonna give you up");
  windows.alert("Never gonna let you down");
  windows.alert("Never gonna run around and desert you");
  windows.alert("Never gonna make you cry");
  windows.alert("Never gonna say goodbye");
  windows.alert("Never gonna tell a lie and hurt you");
  </script>
</html>

6 个答案:

答案 0 :(得分:2)

[你有3个错误]

-1st <title=You Got RickRolled>应为<title>You Got RickRolled</title>

- 使用alert("We're no strangers to love");或window.alert

-3rd确保您拥有<head><body>

  

<head>

     

HTML元素提供有关文档的一般信息(元数据),包括标题及其脚本和样式表的链接。

     

参考:https://developer.mozilla.org/en/docs/Web/HTML/Element/head

     

<body>

     

HTML元素表示HTML文档的内容。文档中只能有一个元素。

     

参考:https://developer.mozilla.org/en/docs/Web/HTML/Element/body

<!DOCTYPE HTML>
<html>

<head>
  <title>You Got RickRolled</title>
</head>

<body>
  <script>
    alert("We're no strangers to love");
  </script>
</body>

</html>

答案 1 :(得分:1)

  1. 添加<head><body>代码
  2. windows.alert()更改为window.alert()
  3. Here it is in codepen。可能不会打'跑'。有用。我承诺。

答案 2 :(得分:0)

[]中的消息框是

JavaScript

答案 3 :(得分:0)

window.alert(),而不是windows

您甚至可以忽略窗口。

Undefined symbols for architecture x86_64:
"pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)", referenced from:
  int pcl::PCDWriter::writeBinary<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&) in main.o
  int pcl::PCDWriter::writeASCII<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&, int) in main.o
"pcl::PCDWriter::writeASCII(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, int)", referenced from:
  pcl::PCDWriter::write(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, bool) in main.o
"pcl::PCDWriter::writeBinary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&)", referenced from:
  pcl::PCDWriter::write(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, bool) in main.o
"pcl::PCDWriter::setLockingPermissions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::interprocess::file_lock&)", referenced from:
  int pcl::PCDWriter::writeBinary<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&) in main.o
  int pcl::PCDWriter::writeASCII<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&, int) in main.o
"pcl::PCDWriter::resetLockingPermissions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::interprocess::file_lock&)", referenced from:
  int pcl::PCDWriter::writeBinary<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&) in main.o
  int pcl::PCDWriter::writeASCII<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&, int) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

答案 4 :(得分:0)

alert('Never gonna give you up');

而不是:

windows.alert('never gonna let you down');

Windows不是一件事。

window.alert('never gonna run around');

本来也会奏效。

答案 5 :(得分:-1)

我还会做出其他一些标记更改:

    <!DOCTYPE HTML>
    <html>
    <head>
    <!-- Put the <title> tag within a '<head>' tag -->
      <title>You Got RickRolled></title>
    </head>
<!-- You want a body tag inside your <html> tags -->
    <body>
      <script>
      alert("We're no strangers to love");
      /* Rest of lyrics here */
      </script>
      </body>
    </html>