We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello world I really need help with this one guys.. Is there any chance to read a button state from JavaScript to my processing Application? I have my own website .And from here i want to controll for example a collor of a Rect when this button is pressed:
<script type="text/javascript">
function writeText()
{
alert("Color changed to Red");
}
</script>
</head>
<body>
<form>
<input type="button" value="Red"
onclick="writeText()" >
Is there any way to do this? ThankYou.
Answers
If you wanna interact w/ HTML elements, p5.js is a better project than JavaScript Mode: http://p5js.org/
JavaScript Mode, a.K.a. processing.js project, is a bridge to convert Java Mode sketches to run in the web as JS!
Although it's perfectly possible to interact w/ the browser's DOM within JS Mode, it's awkward & harder doing so!
P.S.: Take a peek at this recent forum thread: ;)
http://forum.processing.org/two/discussion/7246/dom-checkboxs-reading-and-setting-the-checkmark
Another P.S.: If you still wanna use the old processing.js for DOM access, take a look at this article:
http://processingjs.org/articles/PomaxGuide.html