Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About antidot

  • Rank
  1. Hmmm. Sometimes stepping away helps... Just tried the .children[0].value . Works fine! i guess getElementsByTagName would work as well ...
  2. Hi, i'm struggeling a bit while i'm trying to acces the value of inputfields inside tablecells. I don't have ids available and hve to check row by row or jus specified rows. function test(){ var tableBody = document.getElementById("testCalc"); var tableBodyRows = tableBody.rows.length; console.log(tableBody); console.log(tableBody.rows[0].cells[4].?); } .value .innerHTML.value .textContent all won't work. Any suggestions?
  3. Thx. I am already taking a closer look on how to define regExp. It's beginning to be fun :-)
  4. I will check out tomorrow. Time to sleep. Thx for fast reply
  5. Hi, i'm reading back and forward but not really coming t a solution. I would like to grab the content of an input field (not inside a form) i am using for date, but just as string. the needed output format is always DD/MM/YYYY so said : 12.02.16 or 2016 12.2.16 or 2016 12-02-16 and so on should all result in 12/02/2016 if there would be a timestamp behind it just needs to be cutted off. I really thought this would be easier :-) But it isn't Maybe somebody could point out a good article or solution for me. Thx. I'm really struggling with the regu
  6. Well, did some changes. working better already. function generate_table() { // get the reference for the body var body = document.getElementsByTagName("body")[0]; var x = document.getElementById("TableB").rows.length; var y = document.getElementById("TableB").rows[0].childElementCount; var z = document.getElementById("TableB").rows[0].cells[2].innerText; var origTable = document.getElementById("TableB"); alert("x=" + x + " y=" + y + " z=" + z); // creates a <table> element and a <tbody> element var tbl = document.createElement("table"); va
  7. Hi, im a little bit struggling here. What I am trying to do is read the content from a Table by reading the number of rows and cells,(later on only selected rows by checkbox) then display the data in a ┬┤generated Table (where i have to add cells with inputfields) So now my question is: How do i have to write the code so the first row will be created with <th> instead of <td> ? How to add input fields to the cells ? (actually they all could be input fields, just filled out with the data from the table i read from and blank fields for the added or so on.) function generate
  8. hmm. didn't work on my console... whatever. i'll figure it out some day :-)
  9. // four variables are created and assigned in a single go, // separated by commas var myObj = new Object(), str = "myString", rand = Math.random(), obj = new Object(); myObj.type = "Dot syntax"; myObj["date created"] = "String with space"; myObj[str] = "String value"; myObj[rand] = "Random Number"; myObj[obj] = "Object"; myObj[""] = "Even an empty string"; console.log(myObj); function showProps(obj, objName) { var result = ""; for (var i in obj) { if (obj.hasOwnProperty(i)) { result += objName + ".
  10. @dsonesuk thx alot for your help. Sometimes it's just hard to find the correct function, method or whatever... if i would want to have the var spieler not as global, would it be better to construct the whole thing as an object so i have the methods present on any object or is there another way? (I'm sure there is) kr ps if i get it right, your example isn't with fallback? and is the IF statement necesary in this case? I understand it that if the class is present on the actual element it gets removed and added again. So the work for removing on all other elemts is done b
  11. Thx alot for all the help. I am quite busy so i don`t have as much time as i would like to... So far i am going with this solution: function ReplaceContentInContainer(content, id) { var container = content.innerHTML; this.className = 'smallCard.current'; document.getElementById(id).innerHTML = container; // console.log("CONSOLE TEST"); } { var spieler = document.getElementsByClassName("smallCard"); for (var i = 0; i < spieler.length; i++) { spieler[i].addEventListener("click", (function(){ReplaceContentInContainer(this, "fc")})); } } while changing of t
  12. I want to grab the content from an element i am clicking on to be displayed in another element. Have to dig through your example... appreciate the help
  13. Thx for the help! So you are saying, i have to create an anonymous function if i want to execute another Function and passing arguments? usually my function looks like this: function ReplaceContentInContainer(id,content) { var container = document.getElementById(id); container.innerHTML = content; } so when calling like so, it should work? spieler[i].addEventListener("click", function() { ReplaceContentInContainer("anyID", this.innerHTML); } I'm reading on mdn about addEventLister, but i still don't get it. Personally the "HOW" is very important to me.
  14. Hi, i really don┬┤t know how to solve this, or why it isn't working... first i try to grab all elements havung a specified class. no matter if it's 1 or 1000 elements. After that all of those elements will have assigned an eventListener which then calls the function to replace the content from the clicked element in another specified element. (by taking and replacing inner html). Usually i had the targetcontainer as 2nd argument in the eventlistener, but that didn't work at all. See for yourself what happens. Funny that when using the displayDate function everything works fine... var
  • Create New...