Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

<a href and onclick="javascript: ....

Engaged ,
Oct 23, 2006 Oct 23, 2006
Hi,
Again a calendar application question. I have a dynamic table representing the month, created through cfloop. I want to give the user the choice to select a date and when they click on "weekly view" on top it shows the week pertaining to that date. This perforce has to be through javascript. For my link to work for users with javascript disabled, I want the link to point to the first week of that month. Something like this:
<ahref ="weeklycalendar.cfm?month=#currentmonth#&year=currentyear#&day=1" onclick ="javascript"weeklcal()>
The javascript picks up the selected cell of the table and hence the selected date. It has the same parameters as the href except that the day is the selected date and not 1.
Can this be made to work. Any suggestions, advice,opinions would be greatly appreciated.

Thx in advance
530
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Oct 23, 2006 Oct 23, 2006
Found the solution, just incase anyone else is interested:
You use- return false and everything degrades gracefully. For users with javascript enabled, the javascript works and the href doesn't , and for users with javascript disabled, the href works.
The synatx would be something like
cfoutput><ahref ="weeklycalendar.cfm?month=#currentmonth#&year=#currentyear#&day=1" onclick ="javascript:weeklcal(); return false"></cfoutput>
Translate
Engaged ,
Oct 23, 2006 Oct 23, 2006
This should have been
<cfoutput><ahref ="weeklycalendar.cfm?month=#currentmonth#&year=#currentyear#&day=1" onclick ="javascript"weeklcal()></cfoutput>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 23, 2006 Oct 23, 2006
LATEST
Found the solution, just incase anyone else is interested:
You use- return false and everything degrades gracefully. For users with javascript enabled, the javascript works and the href doesn't , and for users with javascript disabled, the href works.
The synatx would be something like
cfoutput><ahref ="weeklycalendar.cfm?month=#currentmonth#&year=#currentyear#&day=1" onclick ="javascript:weeklcal(); return false"></cfoutput>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources