Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I have managed to get a few simple JavaScripts into RocketCake but I am struggling with many. For example: <HTML> <HEAD> <SCRIPT> function changecolor(code) { document.bgColor=code } </SCRIPT> </HEAD> <BODY> <form> <input type="button" name="Button1" value="RED" ="changecolor('red')"> <input type="button" name="Button2" value="GREEN" ="changecolor('green')"> <input type="button" name="Button3" value="BLUE" ="changecolor('blue')"> <input type="button" name="Button4" value="WHITE" ="changecolor('white')"> </form> </BODY> </HTML> I added the script to the header and then created the form, adding the in the HTML of the button. That didn't work. I also tried just copying all of it into a HTML Code box and that didn't work either. Any ideas of how to get the code to work (it works when using Notepad outside of RocketCake)? The specific code doesn't matter too much - I want to learn how to actually get the code in generally. |
||||
|
Remove the opening and closing tags of HTML and HEAD and BODY, and paste thevremaing code into a html code element, then it will work. |
||||
|
Thanks I tried adding like this: https://snipboard.io/dQJ7s2.jpg and the output is: https://snipboard.io/rZ2Fdg.jpg but it doesn't work. I can get some JavaScript code snippets to work. |
||||
|
It works for me when I change the function above to function changecolor(code) { And you also need to have the even handler in the button be named o n c l i c k (without the spaces). This forum swallows this word, so in your code, this is missing. then it works, tried it out. |
||||
|
Thanks that worked fine - will practice more with different scripts to get used to it! |
|