|
Author |
Topic: Passing Parameters from the Web Page (Read 2541 times) |
|
anhinga
|
Passing Parameters from the Web Page
« on: Aug 10th, 2003, 6:44am » |
|
Is it possible to pass parameters from the web page to proce55ing? I would like to imbed the same procesing app in a few diffrent web pages, but change some colors. i suppose i could recompile a different version of the same app for each page, but i would like to keep the download time of the site to a minimum. thanks, jason
|
|
|
|
toxi
|
Re: Passing Parameters from the Web Page
« Reply #1 on: Aug 11th, 2003, 3:05pm » |
|
AFAIK there's no direct Processing way to get parameters, but you can use the plain java syntax: Code:void setup() { try { int bg = Integer.parseInt(getParameter("bg"),16); int r = bg >> 16 & 0xff; int g = bg >> 8 & 0xff; int b = bg & 0xff; background(r,g,b); } catch (Exception e) { background(0); // default colour } } |
| then add this tag below to the <applet> tag in your html document: <param name="bg" value="ffcc00">
|
« Last Edit: Aug 11th, 2003, 3:09pm by toxi » |
|
http://toxi.co.uk/
|
|
|
anhinga
|
Re: Passing Parameters from the Web Page
« Reply #2 on: Aug 14th, 2003, 8:58am » |
|
Thank you very much. Your code works wonderfully. jason
|
|
|
|
Mythmon
|
Re: Passing Parameters from the Web Page
« Reply #5 on: Feb 20th, 2004, 4:56am » |
|
is there any way to use the http://www.mysite.com/mypage.html&?var=12 form of passing parameters to applets? i know it possible in flash, i think
|
|
|
|
Bijeoma
|
Re: Passing Parameters from the Web Page
« Reply #6 on: Feb 20th, 2004, 7:50am » |
|
if you know a server side lanuage you can write the html document. and use the var as a variable for a parameter in the applet tag.
|
|
|
|
|