CreateElement Wont Show Table/div?

Apr 19, 2005

I've come up with this code and cant figure out why nothing appears when I press the buttonThe table is soposed to show. Probably something really simple cuz I often stuck on stupid things.

[HTML]<html>
<head>
<script type="text/javascript">

[code]....

View 6 Replies


ADVERTISEMENT

Using CreateElement To Insert A New Row Into A Table

Jul 28, 2004

<table id="test" style="width:200px;border: thin solid blue;">
<tr>
<td>
Test row 1
</td>
</tr>
</table>


I have a table like above and want to use document.createElement to insert a new row at the end of the table before the close table tag, is this possible?

My efforts so far have resulted in the following html:

<table id="test" style="width:200px;border: thin solid blue;">
<tr>
<td>
Test row 1
</td>
</tr>
</TBODY>
<TR>
<TD>Test row 2</TD>
</TR>

Which doesn't display properly as table has already been closed

This is the code I've knocked up for the test so far:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script>
function test(tableObj)
{
alert(tableObj.innerHTML);
//var newTable = document.createElement("table");
var newRow = document.createElement("tr");
var newCol = document.createElement("td");
newCol.innerText = "Test row 2";
newRow.insertBefore(newCol);
tableObj.appendChild(newRow)
alert(tableObj.innerHTML);
}
</script>

<body onload="test(document.all.test)">
<table id="test" style="width:200px;border: thin solid blue;">
<tr>
<td>
Test row 1
</td>
</tr>
</table>
</body>
</html>

View 7 Replies View Related

JQuery :: Toggle Function - Hide/show Table When Hide/show Button Is Pressed

Sep 12, 2011

I am trying to hide/show table when hide/show button is pressed

Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.

Code:

View 1 Replies View Related

Show/hide A Table Row

Jul 23, 2005

I would like to add some javascript to show/hide a certain row of a
table. The first row of the table contain the hyperlink that calls the
javascript the second row is the one i want to show/hide with the
javascript in a toggle fashion.

the problem is a know very little javascript and have become incredibly
frustrated because i went ahead thinking it was going to be like C. its not.

I know i can use these lines to do the actual work:

document.getElementById("row").style.display = "none"; // hides row
document.getElementById("row").style.display = "inline"; // shows row

but I don't think i can use a getElementById exactly because i want to
reference the element via its relationship to the hyperlink that calls
the javascript, i know this can be done. You see there will be several
tables on one page and i want to be able to toggle each one
independently; hopefully with the same bit of javascript.

View 10 Replies View Related

Show / Hide DIV On Different Table Row

Jun 2, 2009

I have a table with three columns (and about 20+ rows). The third column has embedded javascript to show/hide additional information. It works, however when I try to show/hide information on a different table row (except the top), only the top row opens/shows.

Here's my script:
<script language="javascript">
function toggle() {
var ele = document.getElementById("toggleText");
var text = document.getElementById("displayText");
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "Show";
}else {
ele.style.display = "block";
text.innerHTML = "Hide";
}}
</script>

And here's my HTML:
</head><body>
<h2>Beaus CD Collection</h2>
<table border="1">
<tr bgcolor="#99CCCC">
<th>Artist:</th>
<th>Album Title:</th>
<th>More Information:</th></tr>
<xsl:for-each select="CATALOG/CD"><tr>
<td><xsl:value-of select="ARTIST"/></td>
<td><xsl:value-of select="TITLE"/></td><td>

<a id="displayText" href="javascript:toggle();">Show</a>
<div id="toggleText" style="display: none">
<ul>
<li>Country: <xsl:value-of select="COUNTRY"/></li>
<li>Record Company: <xsl:value-of select="COMPANY"/></li>
<li>Price: <xsl:value-of select="PRICE"/></li>
<li>Year of Release: <xsl:value-of select="YEAR"/></li>
</ul></div>
</td></tr>
</xsl:for-each>
</table></body></html>
</xsl:template>
</xsl:stylesheet>

I didn't form this script myself - I just grabbed it online from a separate source.

View 2 Replies View Related

Show Row On Table Row On Click

Jun 21, 2011

I created a javascript function to show/hide element id. In the code, the detail row will be show when its header row is clicked and the detail row will be hiiden after the hyperlink is clicked.

How to show/hide the detail row whenever its header row is clicked? For example, if I clicked header row #2, it will show detail row #2 and hide detail rows #1 and #3.

View 9 Replies View Related

JQuery :: Hide & Show Table Row?

Apr 27, 2011

jquery hide & show table row concept

View 1 Replies View Related

JQuery :: How To Show Table Cell

Jun 15, 2010

I have a form as below, the sFilename will be changed in aspx.cs, I hope the table will be showed after sFilename changed, what can I do?

[Code]...

View 7 Replies View Related

JQuery :: Slide Show Within Table?

Aug 9, 2011

have set up a simple slide show within a table to present as redesign option on home page for a new client. The SS is working fine but the rest of the content that follows in rows beneath are not showing when the page loads. They do appear when you hit refresh. what's blocking the load. Here's the link to the test page:[URL]

View 2 Replies View Related

JQuery :: Show/Hide Div In Table In IE?

Apr 23, 2010

Note that these issues are specific to IE8, and I am using for the purpose of creating a program which works in IE, FF, Chrome, so I've only tested my solutions in those 3. I wasn't sure whether to start this as a question (as I am asking for an easier solution) or if I note it as a problem or discussion.

Any time I've used .show(x) where x > 0 on anything inside of a table, I get this "flicker", which has been mysterious to me for a while. As I need the row to expand it's height when the object grows, so I can't use "position:absolute;", which I found as a suggestion elsewhere (and does work...if the space is already allocated).

[Code]...

I hope this helps anyone who is having the IE "flicker" issue, and I hope even more that someone out there can give an easier solution!

View 2 Replies View Related

Regarding The Hide/show Of The Cells In A Table?

Aug 16, 2010

I have a query regarding the hide/show of the cells in a table.

The first column is 'Yes and No' options using combo box, 2nd option is 'input field', 3rd column is also 'Yes and No' option using combo box, and 4th option is also 'input field'.

What I want is to make a table using JAVASCRIPT, in which if i select 'No' from the first row first column, i want to hide the remaining 3 cells of the first row. Otherwise if i select 'yes' from the first row first column i want to show all the 3 other options of the first row. Also in between if I select 'No' from the first row third column i want to hide the first row fourth column cell. Selecting 'yes' from the first row third column will show the first row fourth column.

I want apply the same setting of hide and show cells into the remaining columns also.

By selecting 'no' from first column -> hide other corresponding cells of the row
by selecting 'yes' from the first column -> show other corresponding cells of the row

AND ALSO

By selecting 'no' from third column -> hide fourth cell of the corresponding/same row by selecting 'yes' from the third column -> show fourth cell of the corresponding/same row

View 1 Replies View Related

JS-created Table Doesn't Show In IE?

Mar 22, 2010

what is wrong in the following piece of code? It works fine in Firefox, Safari, Chrome and Opera, but won't work in IE.

The purpose of the function is to receive a list of discussion threads that are available on the site and list them in a simple table, which is created by the function and placed in a div. More specifically:

(1) The function receives a json called "threads" (obtained through Ajax from a server-side PHP script).

(a) The 2nd element in the json, "records" is an array of records, one record for each thread.

(b) The 1st element in the json, "fields", identifies the integer keys of the id and title of each thread in the corresponding record.

(2) The function creates a table with one tr for each thread record. In each tr, there is one td with the thread's id and one with its title.

(3) Finally, the function places the table in a div with the id "discBdCont".

In both Firefox, Safari, Opera and Chrome, the table appears as it should. In IE, however, the table does not appear at all (although the text "Available discussion threads:" does appear, and I see no error messages or anything).

Code:

var discBoardRecords;
var idKey;
var titleKey;

[Code]....

View 3 Replies View Related

Show / Hide Table With A Click?

Nov 19, 2010

I want to hide a table when user click on a link

this is my code looks like code...

is it possible to hide above table at same time print this link clicked?

View 2 Replies View Related

Display:block To Show A Table?

Jul 5, 2007

I have a javascript/html/css issue that I'm trying to solve for about 3 days now, with no luck. I'm using javascript to toggle the visibility of a certain table. I set the table's display property to none (via js) in order to hide it and to block in order to show it. However, applying block in the display property of a table seems to be having trouble with firefox.

See below what display:block does to a table in firefox: This simple html code:

<table style="display:block" border="1" width="100%">
<tr><td width="100%">test</td></tr></table>
produces this result in firefox:

Notice how the td has the size of the content and does not stretch to the size of the table (although it has a width="100%")? In IE it works fine btw.

If I change my js code to apply "table" to the display property of the table in order to show it, it doesn't show up at all in IE!

View 8 Replies View Related

Hide/show Other Cells In A Row Of A Table?

Aug 10, 2010

I have a query relating javascript hide/show cells in a table

I have created a table of 5 rows and 5 columns. The first row is drop down menu having Yes and No option and remaining cells in the row are two text box and two drop down menu.

I want to hide (or may be block) the other four cells as per the option selected from the drop down menu in the first row. If i select No from the drop down menu from the first row i want to hide the remaining cells in the row and if i select Yes I want to show the remaining cells in the row.

View 1 Replies View Related

Show / Hide Table On Selection?

Nov 17, 2011

I got a selection tag which pulls values from DB to populate,i want to hide or show related div/table based on the selection. now i got two confusions. how can i know what is selected coz the option tag value is coming from DB, also i never work with show/hide thingy. how can i achieve it?

View 6 Replies View Related

How To Show And Hide An Extra Row In A Table?

Feb 4, 2004

I want to show one extra row in a table when the user click on the option button, and hide this row when the user click on the other button. Code:

View 4 Replies View Related

Show And Hide Rows Of The Table?

Mar 15, 2011

I ahve this table as code shown below with buttons Up and down above and below the table respectively now whgat i want to do is that as I have ten enteries in the table.I want to show only 6 of them at one go on a page and the rest 4 should be hidden and when I cliock the "down" button the next four should be displayed and vice versa when I click "up" button the first 6 should be displayed.

Code:
<div >
<input type="button" id="up" value="up"/>[code]....

View 2 Replies View Related

Show Image On Table Rollover?

Feb 14, 2009

I'm trying to get an image to display when a table is rolled over, but cannot get it to work.

<table width="100%" onmouseover="document.hidebutton.src=setAttribute('src','/images/hidebutton.png')" onmouseout="document.hide.src='document.hidebutton.src=setAttribute('src','')">
<tr>

[Code]....

View 2 Replies View Related

JQuery :: Show/Hide Table Rows

May 4, 2011

I have a table that is set up to look like a menu and would like to show/hide certain rows, the problem is that the rows do not have id's...basically, it looks like this:

<table class="mainTable">
<tbody>
<tr><td class="Level1 Selected"><a href="page1.aspx">Page 1</a></td></tr>[code]....

Ultimately, what I would like to do is: show all Level1 rows.hideadditionallevels below Level1 (which could be any number deep)
and finally, if row is selected then show additional levels below (td class will change to "Selected" when on the page) and above (ie. if Level2 is selected).

View 4 Replies View Related

Show Hide Table Row Depending On A Variable?

Jan 28, 2010

I have a multipage form. I can put data entered in hidden form elements from previous pages. I want to show or hide table rows depending on this data value.
For example, I collect a list of names in first form, but if some names are blank I dont want to show the table row associated with that name to collect more data.
I have seen loads of code to toggle rows but cant find any which shows me how to toggle on a variable.

View 2 Replies View Related

Hide / Show Table Plus Reset Button?

May 12, 2011

I need a button that not only resets what is typed in the textarea but also hides all shown tables...[code]...

View 3 Replies View Related

Cells Hide/show In Each Of The Rows Of A Table?

Aug 16, 2010

I have a query regarding the hide/show of the cells in a table.The first column is 'Yes and No' options using combo box, 2nd option is 'input field', 3rd column is also 'Yes and No' option using combo box, and 4th option is also 'input field'.What I want is to make a table using JAVASCRIPT, in which if i select 'No' from the first row first column, i want to hide the remaining 3 cells of the first row. Otherwise if i select 'yes' from the first row first column i want to show all the 3 other options of the first row. Also in between if I select 'No' from the first row third column i want to hide the first row fourth column cell. Selecting 'yes' from the first row third column will show the first row fourth column.I want apply the same setting of hide and show cells into the remaining columns also.

By selecting 'no' from first column -> hide other corresponding cells of the row by selecting 'yes' from the first column -> show other corresponding cells of the row

AND ALSO

By selecting 'no' from third column -> hide fourth cell of the corresponding/same row by selecting 'yes' from the third column -> show fourth cell of the corresponding/same row

I have posted this question in the tablular form, but it is now showing in the proper format. Anyone in the forum please help me to make this table using JAVASCRIPT. I need this table within a day or two.

View 3 Replies View Related

Show / Hide Table Rows Via Checkboxes?

Sep 2, 2010

I've got a table that I want to be able to show/hide rows based on what check box is checked. By default, I don't want anything displayed, then if you check a or some of the check boxes you'll see the data.Here is what I have, which has some effect in FF but does not work at all in IE.This is my script (which is part mine, part web-found)

<style type="text/css">
.this {
display: none;[code]......

View 3 Replies View Related

Show / Hide Table Rows, But 1st Row Always Shows?

May 4, 2009

I am generated some HTML / Javascript through the use of some XSLT, and what I aim to do is generate a table with many rows where we always have the 1st row showing (which has a +/- image there for users to click so that they can expand/collapse the rest of the rows in that table). I am having trouble with the Javascript on assigning the relevant class to the rows so that they get hidden or shown.So far my XSL is outputting the following...

HTML Code:
<table class="InfoBlock" cellspacing="0" cellpadding="0">
<col class="report_column_headings">[code]...

I know I am violating HTML here by having many tags with the same ID, but I am just looking for ways to get this to work.what I place in my 'ShowHide()' javascript method?

View 1 Replies View Related

Several Rows In A Table With The Same Id So I Can Show/hide Them In A Block?

May 27, 2009

is it possible to have several rows in a table with the same id so i can show/hide them in a block?I have also tried adding a span around the block of rows but that doesn't work ( I seem to remember you cant hava a span around TR tags?)

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved