This topic is locked

onclick code is rendered differently

5/28/2010 5:55:16 PM
ASPRunnerPro General questions
T
tone21705 author

On the Editor screen for the List page there is a column called Message.

When I double click the yellow box the Message: View as" settings window appears.
I selected custom and put in this code.

strValue = ("<img src='http://"; & Session("HostServer") & "/UnusualOccurrence/WebLHH/images/noMessage.jpg' alt='No New Msg' height='15' width='25' onClick='openMessage('" & rs("ID") & "');' />")


When I build this project and look at the source code it renders this:

<img width="25" height="15" );="" 455="" onclick="openMessage(" alt="No New Msg" src="https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=14531&image=1&table=forumtopics">;


As you can see its not the same as I put it in. The 455 is the records ID, so that is displaying correctly but why is it moving the alt and src properties? I obviously get a javascript error because the syntax is wrong.

I thought maybe it was ASCII so I took out the );= but it was the same.
Really strange,
Thanks for any help in advance.
PS I put the javscript function openMessage as well as all the jquery includes/custom functions in the header do you think that is the best placement for that thing?
Antoni

A
ann 5/31/2010

Antonio,
your custom code wasn't correct. Here is the correct code:

strValue = "<img src=""http://"; & Session("HostServer") & "/UnusualOccurrence/WebLHH/images/noMessage.jpg"" alt=""No New Msg"" height='15' width='25' onclick=""openMessage('" & rs("ID") & "');"" />"