• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

HELP: Tricky display...

Note original post wi. right formating may be found here: http://www.dslreports.com/forum/remark,15879283

Hmmm what work around could you think of where:

by calling a JSP tag:
<c:out value="${item.title}">[/code]
what becomes:
The "special" season has arrived.[/code]
As you can see the title has double quotes in them;
However the double quotes are transformed into:
the " - double quotation mark
but that still makes a JavaScript fail when used like so:
<a href=# onclick='javascript=alert("<c:out value="${item.title}">");'>onclick avascript alert</a>
as it becomes:
<a href=# onclick='javascript=alert("The &#34;special&#34; season has arrived.");'>onclick avascript alert</a>
what fails
Idealy we would have:
<a href=# onclick='javascript=alert("The \"special\" season has arrived.");'>onclick avascript alert</a>
but I do not have control over what
<c:out value="${item.title}">
returns (it's just a functionality give to me)[/code]
What do you think would be a good work around to make the tag work inside of a JavaScript...

Any tips, tricks, links, suggestions are much appreciated ;)

<I>Thank you all...</I>
1 Solution

Seems to show that you can use a DIV and innerHTML to get these codes converted to their real chars...

I would probably try to avoid using alert() as it never looks nice

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now