Forum Moderators: open
Rows are clickable <tr onclick="...">
How do I put information from whole row that is clicked into a parent form inputs
<form><input type="text" name="no" id="no">?
What do I have to place in onclick in a <tr> and what in parent window?
Thanks for any advice.
Michal Cibor
this may give you a few ideas to play with...
iframe.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>iframe</title><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
body {
background:#aaa;
}
#ifrm {
width:512px;
margin:20px auto;;
}
#ifrm iframe {
width:512px;
height:100px;
}
#inpts {
width:480px;
margin:20px auto;
}
#inpts input {
width:150px;
font-size:14px;
text-align:center;}
/*//]]>*/
</style><script type="text/javascript">
//<![CDATA[
//]]>
</script></head>
<body><div id="ifrm">
<iframe src="table.html" scrolling="no"></iframe>
</div><form action="">
<div id="inpts">
<input type="text"/>
<input type="text"/>
<input type="text"/>
</div>
</form></body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>three cell table</title><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
body {
margin:20px;
background:#ccc;
}
#tble {
border:solid 1px #000;
background:#fff;
}
#tble td {
width:150px;
height:50px;
border:solid 1px #000;
font-size:12px;
text-align:center;
cursor:pointer;
}
/*//]]>*/
</style><script type="text/javascript">
//<![CDATA[
function doStuff(num,el) {
parent.document.forms[0][num].value=el.innerHTML;
}
//]]>
</script></head>
<body><table id="tble"><tr>
<td onclick="doStuff(0,this)">cell one information</td>
<td onclick="doStuff(1,this)">cell two information</td>
<td onclick="doStuff(2,this)">cell three information</td>
</tr></table></body>
</html>
birdbrain