Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Script question....

Script question....

Scheduled Pinned Locked Moved Web Development
questionjavascripttools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KORCARI
    wrote on last edited by
    #1

    Hi. How can I transform this javascript code function insRow() { var x=document.getElementById('myTable').insertRow(0) var y=x.insertCell(0) var z=x.insertCell(1) y.innerHTML="NEW CELL1" z.innerHTML="NEW CELL2" }

    Row1 cell1

    Row1 cell2

    Row2 cell1

    Row2 cell2

    Row3 cell1

    Row3 cell2

    so values NEW CELL1 and NEW CELL2 can be inserted by user in two different textboxes.

    H 1 Reply Last reply
    0
    • K KORCARI

      Hi. How can I transform this javascript code function insRow() { var x=document.getElementById('myTable').insertRow(0) var y=x.insertCell(0) var z=x.insertCell(1) y.innerHTML="NEW CELL1" z.innerHTML="NEW CELL2" }

      Row1 cell1

      Row1 cell2

      Row2 cell1

      Row2 cell2

      Row3 cell1

      Row3 cell2

      so values NEW CELL1 and NEW CELL2 can be inserted by user in two different textboxes.

      H Offline
      H Offline
      howardjr
      wrote on last edited by
      #2

      Firstly the removed in your Insert row button should be onClick. That's the event that gets called when you click the button, and executes your insRow() function. It not clear to me what you want when you say "so values NEW CELL1 and NEW CELL2 can be inserted by user in two different textboxes". With onClick instead of removed in your button, the code inserts a two new cells into your table. Are these the two different textboxes you are refering to? If not then you need to add them to your page, either using javascript or as HTML tags, similar to the way you created the button. Then, assuming that the textboxs you add have ids of textbox1 and textbox2, it's just a matter of adding statements like this to your insRow() function:

      textbox1.value = "NEW CELL1";
      textbox2.value = "NEW CELL2";
      
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups