How can I write the contents of a variable into the text area of a <td>here</td>
with javascript? I would like to prompt the user using the called function onclick and store what they type into a variable and then write the string saved to that variable into the same <TD>
that the form/input/prompt function call is in.
I'm thinking that this can be done by accessing the column via the class attribute. Ideally, I'd like the function(s) to be independent and robust such that I can use them for several different columns based on the 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>
I'd recommend using jQuery though, much more beginner friendly / less error prone. In that case it would be: