Hi.
How to set bgcolor within td tag (cl-who):
(:td (ps (setf bgcolor "blue")))
or something like this to get
this.bgcolor="blue" ?
Thanks
If I understand correctly, your problem is that you want to express HTML in sexprs à la CL-WHO but with inlined PS expressions to dynamically change what gets emitted. Since you want PS expressions, you must be generating this HTML at runtime in the browser. Is that right?
It so happens that I got frustrated with doing the same thing yesterday and wrote a macro to allow me to inline HTML inside PS in this way. Before I post it, though, I want to make sure it at least covers all our existing cases.
Can other people pipe up and explain what they do to generate HTML from PS? Is there currently a standard solution better than "<div>"+blah+"</div>"?
Daniel
2010/6/20 Haris Bogdanović fbogdanovic@xnet.hr
Hi.
How to set bgcolor within td tag (cl-who):
(:td (ps (setf bgcolor "blue")))
or something like this to get
this.bgcolor="blue" ?
Thanks
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
Parenscript has always had an s-expr HTML markup generator (http://common-lisp.net/project/parenscript/reference.html#ssection-html-gen). Or am I being dumb and you're talking about something else?
Vladimir
2010/6/20 Daniel Gackle danielgackle@gmail.com:
If I understand correctly, your problem is that you want to express HTML in sexprs à la CL-WHO but with inlined PS expressions to dynamically change what gets emitted. Since you want PS expressions, you must be generating this HTML at runtime in the browser. Is that right? It so happens that I got frustrated with doing the same thing yesterday and wrote a macro to allow me to inline HTML inside PS in this way. Before I post it, though, I want to make sure it at least covers all our existing cases. Can other people pipe up and explain what they do to generate HTML from PS? Is there currently a standard solution better than "<div>"+blah+"</div>"? Daniel
2010/6/20 Haris Bogdanović fbogdanovic@xnet.hr
Hi.
How to set bgcolor within td tag (cl-who):
(:td (ps (setf bgcolor "blue")))
or something like this to get
this.bgcolor="blue" ?
Thanks _______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
<Or am I being dumb and you're talking about something else? >
Not at all, I forgot about it. I think it didn't do what I wanted way back when, but I'll check it out again and report back. Thanks for reminding me.
Dan
On Sun, Jun 20, 2010 at 11:56 AM, Vladimir Sedach vsedach@gmail.com wrote:
Parenscript has always had an s-expr HTML markup generator ( http://common-lisp.net/project/parenscript/reference.html#ssection-html-gen ). Or am I being dumb and you're talking about something else?
Vladimir
2010/6/20 Daniel Gackle danielgackle@gmail.com:
If I understand correctly, your problem is that you want to express HTML in sexprs à la CL-WHO but with inlined PS expressions to dynamically change what gets emitted. Since you want PS expressions, you must be generating this HTML at runtime in the browser. Is that right? It so happens that I got frustrated with doing the same thing yesterday and wrote a macro to allow me to inline HTML inside PS in this way. Before I post it, though, I want to make sure it at least covers all our existing cases. Can other people pipe up and explain what they do to generate HTML from PS? Is there currently a standard solution better than "<div>"+blah+"</div>"? Daniel
2010/6/20 Haris Bogdanović fbogdanovic@xnet.hr
Hi.
How to set bgcolor within td tag (cl-who):
(:td (ps (setf bgcolor "blue")))
or something like this to get
this.bgcolor="blue" ?
Thanks _______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
Sorry, I wrote that wrong. I want to set background color of td cell like this:
<td onclick='this.bgcolor="blue"'> text </td>
with cl-who and ps like:
(:td :onclick (ps ("what goes here to get 'this.bgcolor="blue"' ? ")))
Thanks
Haris,
I'd write this:
(html ((:td :onclick (ps (setf (@ this :background-color) 'blue))) "text"))
to emit this:
<td onclick="this.backgroundColor = 'blue';">text</td>
But that's in LML2, not CL-WHO. If I recall correctly, the reason we switched from LML2 to CL-WHO was greater regularity with macroexpansions, so YMMV.
Daniel
On Sun, Jun 20, 2010 at 12:42 PM, Haris Bogdanović fbogdanovic@xnet.hrwrote:
Sorry, I wrote that wrong. I want to set background color of td cell like this:
<td onclick='this.bgcolor="blue"'> text </td>
with cl-who and ps like:
(:td :onclick (ps ("what goes here to get 'this.bgcolor="blue"' ? ")))
Thanks
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
On Sun, Jun 20, 2010 at 8:42 PM, Haris Bogdanović fbogdanovic@xnet.hr wrote:
Sorry, I wrote that wrong. I want to set background color of td cell like this:
<td onclick='this.bgcolor="blue"'> text </td>
with cl-who and ps like:
(:td :onclick (ps ("what goes here to get 'this.bgcolor="blue"' ? ")))
There are reasons why inline javascript is out of fashion: http://css.dzone.com/news/why-inline-css-and-javascript-
I suggest setting the onclick handler from outside the html, retrieve the td element using an id and getelementbyid, or if it is not unique (an id can't be used) add a class and use some javascript library that can select elements by classname to get the dom element.
/Henrik Hjelte
That article's kind of funny because some of the reasons they give for *not* embedding css/html are the very reasons we *are* embedding it. Reduced download times, for example, and greater maintainability. Moreover, the cache issue is a non-starter when you tag your resources with a hash and make them never expire. I could go on.
The point is that it really depends on the needs of your project and the tools you're using. In good CL tradition I'm sure we can all agree that PS hackers are smart enough to choose rightly.
On Mon, Jun 21, 2010 at 7:51 AM, Henrik Hjelte henrik@evahjelte.com wrote:
On Sun, Jun 20, 2010 at 8:42 PM, Haris Bogdanović fbogdanovic@xnet.hr wrote:
Sorry, I wrote that wrong. I want to set background color of td cell like this:
<td onclick='this.bgcolor="blue"'> text </td>
with cl-who and ps like:
(:td :onclick (ps ("what goes here to get 'this.bgcolor="blue"' ? ")))
There are reasons why inline javascript is out of fashion: http://css.dzone.com/news/why-inline-css-and-javascript-
I suggest setting the onclick handler from outside the html, retrieve the td element using an id and getelementbyid, or if it is not unique (an id can't be used) add a class and use some javascript library that can select elements by classname to get the dom element.
/Henrik Hjelte
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
I agree - most of the problems listed in that article are at the core deficiencies in tools like PHP that offer no control over how HTTP resources are generated and served. IMO setting element event handlers by searching over IDs/CSS classes actually makes maintenance more difficult by introducing unneeded indirection and boilerplate.
But JS links are always the great satan.
Vladimir
2010/6/21 Daniel Gackle danielgackle@gmail.com:
That article's kind of funny because some of the reasons they give for *not* embedding css/html are the very reasons we *are* embedding it. Reduced download times, for example, and greater maintainability. Moreover, the cache issue is a non-starter when you tag your resources with a hash and make them never expire. I could go on. The point is that it really depends on the needs of your project and the tools you're using. In good CL tradition I'm sure we can all agree that PS hackers are smart enough to choose rightly.
On Mon, Jun 21, 2010 at 7:51 AM, Henrik Hjelte henrik@evahjelte.com wrote:
On Sun, Jun 20, 2010 at 8:42 PM, Haris Bogdanović fbogdanovic@xnet.hr wrote:
Sorry, I wrote that wrong. I want to set background color of td cell like this:
<td onclick='this.bgcolor="blue"'> text </td>
with cl-who and ps like:
(:td :onclick (ps ("what goes here to get 'this.bgcolor="blue"' ? ")))
There are reasons why inline javascript is out of fashion: http://css.dzone.com/news/why-inline-css-and-javascript-
I suggest setting the onclick handler from outside the html, retrieve the td element using an id and getelementbyid, or if it is not unique (an id can't be used) add a class and use some javascript library that can select elements by classname to get the dom element.
/Henrik Hjelte
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
HB> How to set bgcolor within td tag (cl-who): HB> (:td (ps (setf bgcolor "blue"))) HB> or something like this to get HB> this.bgcolor="blue" ?
You need to decide how it is going to look in HTML/JavaScript/CSS first. I don't think this is going to work:
<td><script>this.bgcolor="blue";</script></td>
It just doesn't make any sense. Best way to implement this is via CSS:
<style> .blue { background-color: blue;} </style> ... <td class="blue"></td>
If you absolutely want to use JavaScript, you need to assign element ID:
<td id="myTD25"></td>
And then refer to it in JS:
document.getElementById("myTD25").style.backgroundColor = "blue";
parenscript-devel@common-lisp.net