473,395 Members | 2,423 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.

having javascript call a specific value

Hello

I'm a bit new to javascript. Hope somebody can help me

I have a table with 7 colums and 5 rows. 1 row and 1 column has headlines. In the table i have cells with different numbers in them. When i mark a headline row and a headline column a specific celle is highlighted.

What i need is a javascript that shows the user, in text, the value of the cell he has highlighted. Ex: "you have selected column 3, row 4, which has the value xxx".

Perhaps this can be doe be giving each cell a unique id, or something....

Please help......

Thank you!
May 30 '07 #1
8 1425
iam_clint
1,208 Expert 1GB
you can probably piece this togethor by using my example code at the top of the javascript forum for reading cells like excel.
May 30 '07 #2
To some extend useful, yes...... Could you perhaps tell me how to make the content in the cells work like a link, so that when you click it, it shows the value in the text field.....?
May 31 '07 #3
iam_clint
1,208 Expert 1GB
you would add an onclick to display it
Expand|Select|Wrap|Line Numbers
  1. <div id="example"></div>
  2. <table>
  3. <tr><td onclick="document.getElementById('example').innerHTML = this.innerHTML" style="cursor: pointer;"></td></tr>
  4. </table>
  5.  
May 31 '07 #4
Works great, thank you very much!

One little extra thing though you perhaps could help me with.

If i would like there to be a text in front of the content, when clicking it, how would i do that?

Ex. The cell contains the number 100. When clicked, the number appears somewhere else and in front of it, it says, "You have selected 100"
Jun 1 '07 #5
iam_clint
1,208 Expert 1GB
I guess I really don't see what you mean?

Say that again in a different way.
Jun 1 '07 #6
Okay, let me try explaining it again, a bit more in details.

The first script you gave me, you put in a div tag, where the content of the cell should be displayed, when clicking the cell.

in that div tag, i would like there to be some additional text, but only to appear when clicking the contant of the cell.

Let's say the content in the cell says 100 $. When clicking the cell, the div tag should read: "You have selected 100 $".

The "You have selected" part is not visible unless you click the contant of the cell.

Hope this explains it better.....
Jun 4 '07 #7
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <div id="example"></div>
  2. <table>
  3. <tr><td onclick="document.getElementById('example').innerHTML = 'You have selected ' + this.innerHTML" style="cursor: pointer;"></td></tr>
  4. </table>
  5.  
this should work for ya.
Jun 4 '07 #8
Brilliant!!!

Thanks very much....
Jun 5 '07 #9

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

Similar topics

13
by: middletree | last post by:
I have a menu that I use on my Intranet app, and while I did try to replace it recently, I ended up going back to it. It's built entirely with javascript, and works great. However, there are...
10
by: Andy Fish | last post by:
Hi, can anybody put forward a sensible argument javascript's behaviour of creating a new global variable whenever I assign to a previously undeclared variable. I can't beleive this is just for...
2
by: Margaret Werdermann | last post by:
Hi all: I'm having a nasty time with a particularly difficult piece of code and was hoping someone might be able to help me. I have a FormMail form that originally worked perfectly. Then, I...
4
by: houstoncity2004 | last post by:
Hi, I need help to JavaScript. I am new to this, and am trying to the page online ASAP. I have two submit buttons on one form, and each button will have to do different things. I named both...
1
by: ms_chika | last post by:
Please help! I just want to know how can i pass the return value of a javascript function to a xsl variable. I have an xsl file and from that file i will call a javascript function then the...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
3
by: Bill_W_Stephens | last post by:
I am modifying existing javascript code where the author appears to be passing an entire form to a javascript function called Require(). I want to add a new test: "is @BHFOR.value = blanks". ...
1
by: KShapiro | last post by:
Hi All, I am trying to assist my wife, by making a simple menu system for the website. The web page is a .php4 file and does an include of the navigation file. Before it includes that file at...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.