html - How can I write the contents of a variable into the text area of a <td>here</td> with javascript? -


how can write contents of variable text area of <td>here</td> javascript? prompt user using called function onclick , store type variable , write string saved variable same <td> form/input/prompt function call in.

i'm thinking can done accessing column via class attribute. ideally, i'd function(s) independent , robust such can use them several different columns based on class attributes.

<html>  <head> <link href="style.css" rel="stylesheet" type="text/css"> <title>asdfsadf</title>   </head>  <body bgcolor="#000088">  <script type="text/javascript"> function editdates() {     var dates = prompt("fill in date(s) of absence",                          "example: travel 1/7 - 2/10");     document.write. } </script>  <table class="maintable" cellspacing="0" border="1"                           cellpadding="1" width="100%" height="100%">     <tr>         <td>name</td><td class="r1c1">              <form method="link" action="index.html" onclick="editdates();">             <input type="button" name="submit" value="edit"/></form>             </td></tr></body></html> 

document.getelementsbyclassname('yourclass')[0].innerhtml = 'the content'; 

i'd recommend using jquery though, more beginner friendly / less error prone. in case be:

$('td.yourclass').html('the content'); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -