/    Sign up×
Community /Pin to ProfileBookmark

JavaScript help – Urgent

I have a for loop in a jsp which lists 1 to 100 numbers and which are hyperlinked using <a href>. How do i capture the clicked number in javascript.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@KorMay 09.2008 — an example of your HTML code (a single line of your link) will be of some help
Copy linkTweet thisAlerts:
@agowdaauthorMay 09.2008 — The below is the piece of code i have it in my jsp

for(int nextMonthdaynum=0; nextMonthdaynum< 100; nextMonthdaynum++) {

<a href="#" onClick="setDate();" id="selectedDate"> <%= nextMonthdaynum %> </a>

}

the above list 1 to 100 numbers with hyperlinked, i want to capture whatever number is clicked on the hyperlinked number in javascript. how do i do it
Copy linkTweet thisAlerts:
@KorMay 09.2008 — Try:

onlick="setDate();[COLOR="Blue"]alert(Number(this.firstChild.data))[/COLOR]"
Copy linkTweet thisAlerts:
@agowdaauthorMay 12.2008 — Hi, Thanks for your reply. It did help me..

But have another problem.

The main page is a jsp and from this jsp , I am calling another jsp pop up through Iframe. Thsi pop jsp has 1 to 100 hyperlinks. When clicked on this hyperlink, I need to populate the parent jsp text box with the clicked value from the pop up. Can you pelase help me on this ..

Parent JSP Code:

*********************** <td class="left">

<input name="date" value="<%=pageBean.getUserEnteredDate()%>" type="text" size="8" onfocus=" loadAssistDiv(event, 'row1>', 'cal', 'billerInfo', '/billPay/bcCalendar.jsp'); return false;" />

<a href="#" onclick="loadIFrame('/alservlet/BcCalendarServlet?date&payeeId=1&ebillId=2%>', 'CalendarPop', calendrPop, 600, 600);return false;"><img src="/Images/billCenter/calendar.gif" width="19" height="17" align="top" /></a>

</td>

Popup jsp code which opens in Iframe:

*****************************
for(int nextMonthdaynum=0; nextMonthdaynum< 100; nextMonthdaynum++) {

<a href="#" onClick="setDate();" id="selectedDate"> <%= nextMonthdaynum %> </a>

}
×

Success!

Help @agowda spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...