User Profile
Collapse
-
Thanks for the feedback! -
Yeah, I didn't mean to do that. Luckily it still worked, but I have since fixed it. Thanks!
MikeLeave a comment:
-
Possible to shorten this script, or improve it?
Hey all, I am learning javascript at the moment and am loving the challenges. I spent a lot of time figuring out how to do this particular task, which I succeeded in doing; however, I am interested in determining if it can be done in a cleaner fashion...it seems like I should be able to.
Here is the general gist of what was done.
Have a table like so:
11 12 13
21 22 23
31 32 33
41 42... -
Answered my own question - it was actually pretty easy.
Code:function hideRawData() { var tbl = document.getElementById("users_table"); var tblRows = tbl.getElementsByTagName("tr"); var rawData = tbl.getElementsByTagName("td"); for (k=0; k < rawData.length; k++){ //alert(rawData[k].firstChild.nodeValue); rawData[k].innerHTML = "<span>" + rawData[k].firstChild.nodeValue
Leave a comment:
-
That is fantastic - that solved both of the problems that I was having...Leave a comment:
-
How would I go about dynamically adding the <span> tags as innerHTML?
I have a issue, which I am thinking might not be that difficult.
How would I go about dynamically adding the <span> tags as innerHTML (and consequently replacing what is currently in each cell) before the visibility changes.
Seems to be I would first have to collect all of the nodeValues first, then loop through each cell and add an innerHTML of essentially this: '<span>' + nodeValues[i] + <'\span>
...Last edited by Niheel; Oct 13 '11, 03:45 AM. Reason: When posting new questions, best to start a new thread. -
Actually, I got it to work that way already. The problem is that the table disappears completely. I tried setting the height attribute to 23px as you can see and that works vertically, but it just collapses horizontally.
I am assuming there is no real way around this (can't use a constrained width because if the rows are totaled or the table expands to where the number of characters the text is will screw it up). Like I said, this...Leave a comment:
-
Okay, sure...here it is and it is pretty bad, but this is what was given to us to use...I suppose it is the html equivalent of a "worksheet" :)
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Mod 3
Leave a comment:
-
Hiding cell data in a table using JavaScript
As mentioned, I am new to Javascript and have been given an assignment that to me seems way outside the normal scope of what I would ever do in the real world, but nonetheless, here goes.
I have a table that starts like this:
11 12 13
21 22 23
31 32 33
41 42 43
The html has no id's or spans or divs to work with and I cannot change that fact, this is purely traversing DOM stuff here.
... -
Thanks for the info. I came across this code on MSDN that seems to be doing what I need it to. All I want to do intially is set up a blank database that has two tables - one that has a column for the Raffle Numbers (generated and saved from Array) and the date of the generation. The Raffle number will be the PK, then on the second table, I will have fields that contain the following: Ticket ID (which is the PK also and is the same raffle numbers...Leave a comment:
-
VB Array to Database?
To start with, let me lay out the situation. I am a student at the very end of my last assignment of a beginner - intermediate VB class (we have been using VB 2005 Express + MSSQL Express 2005). Anyhow, I really like coding with VB and understand most of what we have learned thus far. However, we have a final project due that is a complete build-from-scratch idea that is useful and contains 10 of 20 requirements as listed on the Rubric.
...
No activity results to display
Show More
Leave a comment: