![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am dynamically building a table from data, and have run into a problem. I have numerous rows and cells that are being created just fine, similar to this: snip However, when I try create a TextNode with a URL in it, I cannot get the escape sequence right to show the URL, similar to this: snip Is there some way to include a URL in a dynamically created textnode? |
#3
| |||
| |||
|
|
I am dynamically building a table from data, and have run into a problem. I have numerous rows and cells that are being created just fine, similar to this: tdElem = document.createElement("td"); tdElem.className = "approved_date"; txtNode = document.createTextNode($rs('approved_date')); tdElem.appendChild(txtNode); trElem.appendChild(tdElem); However, when I try create a TextNode with a URL in it, I cannot get the escape sequence right to show the URL, similar to this: tdElem = document.createElement("td"); tdElem.className = "row_actions"; tdElem.align= "center"; txtNode = document.createTextNode("\<a href=" + "\"" + "javascript:EditLineItem()" + "\"" + ">Edit</a> | Delete"); tdElem.appendChild(txtNode); trElem.appendChild(tdElem); Is there some way to include a URL in a dynamically created textnode? BV. |
#4
| |||
| |||
|
|
"BenignVanilla" <bvanilla (AT) tibetanbeefgarden (DOT) com> wrote in message news:tt-dnYI2t-YAmczZnZ2dnUVZ_sednZ2d (AT) giganews (DOT) com... I am dynamically building a table from data, and have run into a problem. I have numerous rows and cells that are being created just fine, similar to this: snip However, when I try create a TextNode with a URL in it, I cannot get the escape sequence right to show the URL, similar to this: snip Is there some way to include a URL in a dynamically created textnode? I found an answer. Wayne Dobson responded to another thread on a slightly different issue, and I was able to alter my code to match his response to fix my problem... Try: function createHREF(text,href) { var a = document.createElement("A") document.body.appendChild(a) var t = document.createTextNode() t.data = text a.href = href a.onmouseover = gotoHREF a.appendChild(t) a.appendChild(document.createElement("BR")) return a } |
#5
| |||
| |||
|
|
"BenignVanilla" <bvanilla (AT) tibetanbeefgarden (DOT) com> wrote in message news:2N2dnfr8TvcllMzZnZ2dnUVZ_sydnZ2d (AT) giganews (DOT) com... "BenignVanilla" <bvanilla (AT) tibetanbeefgarden (DOT) com> wrote in message news:tt-dnYI2t-YAmczZnZ2dnUVZ_sednZ2d (AT) giganews (DOT) com... I am dynamically building a table from data, and have run into a problem. I have numerous rows and cells that are being created just fine, similar to this: snip However, when I try create a TextNode with a URL in it, I cannot get the escape sequence right to show the URL, similar to this: snip Is there some way to include a URL in a dynamically created textnode? I found an answer. Wayne Dobson responded to another thread on a slightly different issue, and I was able to alter my code to match his response to fix my problem... Try: function createHREF(text,href) { var a = document.createElement("A") document.body.appendChild(a) var t = document.createTextNode() t.data = text a.href = href a.onmouseover = gotoHREF a.appendChild(t) a.appendChild(document.createElement("BR")) return a } I think it was a little long-winded. This would be more concise: var a = document.createElement("A") a.href = href a.appendChild(document.createTextNode(text)) document.body.appendChild(a) document.body.appendChild(document.createElement(" BR")) return a That's without a mouseover effect. |
![]() |
| Thread Tools | |
| Display Modes | |
| |