使用处理函数更改 html 页面

Change the html page using a Processing function

本文关键字:html 页面 处理函数      更新时间:2023-09-26

我有一个处理草图,我想将其嵌入到一个内部的登录页面中,该草图将提示用户按下按钮并进入站点。接收鼠标点击的功能位于处理文件中,但需要更改显示的 html 页面 - 我该怎么做?

<html><head>
     <meta charset="utf-8" />
     <title>Landing page before the main site</title>
    <script src="processing-1.4.1.min.js"></script>
</head><body>
    <canvas id="lander" data-processing-sources="lander/lander.pde"></canvas>
</body></html>

而加工草图具有以下功能:

void mousePressed(){
    if(overBox){
         // push the displayed page to home.html
    }
}

除了一个糟糕的想法,因为你现在已经将应该的Web功能锁定在画布中(这也是我们讨厌Flash的原因),你在JavaScript上下文中,所以你可以调用window.location = "http://....";它就会工作。

也就是说,绝对没有理由在这里做你将要做的事情。一个HTML5 <a href=realpage.html">button label</a>和CSS来设置它看起来像你的按钮是你所需要的,在这种情况下,使用处理是老旧的"你做错了"。