[web-devel] BlazeHtml: How to write quotation-marks in attributes?

dag.odenhall at gmail.com dag.odenhall at gmail.com
Thu Apr 12 02:45:54 CEST 2012


On Thu, Apr 12, 2012 at 2:17 AM, Morel Pisum <morel.pisum at googlemail.com>wrote:

> Hey
>
> Am 12.04.2012 00:44, schrieb Jeremy Bowers:
> > On 04/11/12 16:44, Morel Pisum wrote:
> >> Hi.
> >>
> >> How can I write
> >> <body onload="javascript:document.getElemByID('q').focus();">
> >> in BlazeHtml?
> >>
> >> The problem is that single quotes are always converted to HTML.
> >>
> >> I'd appreciate a quick response. Thanks in advance.
> >>
> > While Jasper's response answered your literal question, I'd add that the
> Yes, Jasper solved my quotation-mark-issue.
> > reason your code isn't working isn't the HTML encoding, which should be
> > left alone. The problem is that your event handler shouldn't have
> > "javascript:" in front of it, and the DOM method is "getElem*ent*ById",
> > not getElemById.
> >
> > Try
> >
> > document.getElementById('q').focus()
> >
> > which should come out with &apos;, which is fine.
> >
> In fact, I had this problem, yes. Thank you for your help but I was able
> to solve this problem before. Thanks anyway.
>

Also it'd be better to use the autofocus attribute of inputs. Javascript
focusing is quirky and not configurable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20120412/12bc6abe/attachment.htm>


More information about the web-devel mailing list