473,395 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Onclick get text

Hi All

i posted this query already... but i didnt get any solution for my problem..
please anybody can provide solution for this

i written a code in my jsp page like this
Expand|Select|Wrap|Line Numbers
  1. <a id=<%=customer%> href='javascript:subwindow(this.id)'> <%=customer%>  </a>
  2.  
my java script function in head section is
Expand|Select|Wrap|Line Numbers
  1.  function subwindow(id) {
  2.  var sel = document.getElementById(id);
  3. var v=sel.text;
  4.   alert(v)
  5.   }
  6.  
but iam not getting the text value of selected link..
is there any modifications to my code
please help me....
Apr 2 '07 #1
7 4031
AricC
1,892 Expert 1GB
Hi All

i posted this query already... but i didnt get any solution for my problem..
please anybody can provide solution for this

i written a code in my jsp page like this
Expand|Select|Wrap|Line Numbers
  1. <a id=<%=customer%> href='javascript:subwindow(this.id)'> <%=customer%>  </a>
  2.  
my java script function in head section is
Expand|Select|Wrap|Line Numbers
  1.  function subwindow(id) {
  2.  var sel = document.getElementById(id);
  3. var v=sel.text;
  4.   alert(v)
  5.   }
  6.  
but iam not getting the text value of selected link..
is there any modifications to my code
please help me....
Are you sure the problem is with the Javascript? in your anchor tag shouldn't you use response.write to write the customer? My ASP is a little rusty.
Apr 3 '07 #2
iam_clint
1,208 Expert 1GB
no you can do <%=customer%>
Apr 3 '07 #3
no you can do <%=customer%>
where can i use this.
can u provide the complete code please.
i wretten a code for link like this
Expand|Select|Wrap|Line Numbers
  1. <a id=<%=customer%> href="#" onClick=subwindow(this.id)> <%=customer%> </a>
  2.  
i written script function like this
Expand|Select|Wrap|Line Numbers
  1. function subwindow(v) {
  2.  var sel = document.getElementById(v);
  3. var d=sel.text;
  4.  
please help me
Apr 3 '07 #4
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <a id=<%=customer%> href="#" onClick=subwindow(this)> <%=customer%> </a>
Expand|Select|Wrap|Line Numbers
  1. function subwindow(id) {
  2. var v=id.text;
  3. alert(v)
  4. }
  5.  
Apr 3 '07 #5
Expand|Select|Wrap|Line Numbers
  1. <a id=<%=customer%> href="#" onClick=subwindow(this)> <%=customer%> </a>
Expand|Select|Wrap|Line Numbers
  1. function subwindow(id) {
  2. var v=id.text;
  3. alert(v)
  4. }
  5.  
sorry iam not getting result again it is showing in alert box as undefined.
selected value is not comming...
and then if click on ok for alert box it is going to previous directory list also
please help me
Apr 3 '07 #6
iam_clint
1,208 Expert 1GB
what value from the link are you trying to get the HREF= would be

var v=id.getAttribute("href");

the text of the link would be
var v=id.innerHTML;
Apr 3 '07 #7
what value from the link are you trying to get the HREF= would be

var v=id.getAttribute("href");

the text of the link would be
var v=id.innerHTML;
Thank you very much...
i got the result..iam able get the selected link value now...
thanks a lot.
Apr 4 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
2
by: Vinita Sharma | last post by:
Hi All, I have a strange problem. I have 2 text boxes and a button in my form. There is a function called on onchange event of the first text box. There is another function called on onclick...
2
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } ...
4
by: Jerry Sievers | last post by:
JS Programmers, "I'm a server-side coder PHP, Postgres etc... My question; Given the following anchor <a href="http://www.somesite.com/somefile.html">link text</a> Is there a way to code an...
4
by: jj6849 | last post by:
I have been using the dom to add a row to my form for awhile now, but now I need to do some validation to make sure certain check boxes aren't checked with other check boxes. Now of course it works...
4
by: sameergn | last post by:
Hi, I have an image in my HTML form which has onclick() handler. There is also a submit button and a text box. Whenever text box has focus and user presses enter, the onclick() event of...
3
by: Michael_R_Banks | last post by:
I'm trying to dynamically build a table that allows users to remove rows when they click a corresponding button. For some reason, whenever I add the button to the table, it never fires the onclick...
10
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I...
2
by: stevemtno | last post by:
I've got a problem with a web page I'm working on. I have 4 modules - one of them has 2 tabs, two of them have 4 tabs. When the user clicks on the tabs, the content below them changes. However, when...
18
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.