Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javs Script Error

Status
Not open for further replies.

portalguy123

Programmer
Sep 19, 2006
40
US
Hello Experts,

Can you please let me know what you think is wrong is the following java script, it seems the browser sees a syntax error at the following line of code.

Thanks in advance..

Code:
<a id="portlet_1_1calendarAnchor9" href="/AnnouncementsNew/Announcement/#" onclick="cal1.select(document[getNetuiTagName("imform",this)][getNetuiTagName("completionDate9",this)],getNetuiTagName("calendarAnchor9",this),'MM/dd/yyyy');return false;">Select Completion Date</a>
 
You have double quotes in your onclick that aren't escaped:
Code:
<a id="portlet_1_1calendarAnchor9" href="/AnnouncementsNew/Announcement/#" onclick="cal1.select(document[getNetuiTagName(\"imform\",this)][getNetuiTagName(\"completionDate9\",this)],getNetuiTagName(\"calendarAnchor9\",this),'MM/dd/yyyy');return false;">Select Completion Date</a>

Lee
 
Thanks Lee!

You came to my rescue again but actually that was the generated HTML , in the sense that was what was generated from a JSP and I posted the view source , do you still think I need to escape the double quotes I already did that in the JSP and they were generated as such..Please let me know..
 
Why would "generated" HTML have to follow different rules than hand-written HTML? You need to write your JSP so it includes the escape characters when it writes the link out.

Lee
 
Thanks Lee,

Now I generated it as follows , but I still get an invalid character error.

-Bob.

Code:
            <a id="portlet_1_1calendarAnchor0" href="/AnnouncementsNew/Announcement/#" onclick="cal1.select(document[getNetuiTagName(\"imform\",this)][getNetuiTagName(\"completionDate0\",this)],getNetuiTagName(\"calendarAnchor0\",this),'MM/dd/yyyy');return false;">Select Completion Date</a>
 
Check it out in Firefox and use the Javascript console to see where the error is.

Lee
 
Lee,

Thanks for the valuable suggestion I did that I see that the error is at the first back ward slash for the double quote , dont know why...Here's the message from the js console..

Code:
Error: illegal character
Source File: [URL unfurl="true"]http://localhost:7788/AnnouncementsNew/Announcements.portal;jsessionid=FZLb0pyCR1ZwlK4p1tdynQs7JpnQ3ycQCwD8n6j6F12hhftwWNWh!76071094?_nfpb=true&portlet_1_1_actionOverride=%2FAnnouncement%2FinsertMessageLink&_windowLabel=portlet_1_1&_pageLabel=Announcements_page_2[/URL]
Line: 1, Column: 37
Source Code:
cal1.select(document[getNetuiTagName(\
 
Single quotes works like a charm thanks Lee and cLFlaVA, becuase of you guys I can leave early today..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top