java web 实现点击左边值,然后显示到右边,在form提交
数据库表a表
id 一级字段name 放一级id
1 一级菜单
2 二级菜单 1
----------
信息表
b表
id 内容 a表的二级id
------------------------------------------------
界面显示
<table >
<tbody>
<tr>
<td>
<ul>
<li>
<ol>
<li class="tltle display-n"><a href="">一级菜单</a></li>
</ol>
</li>
<li class="edit-class-sub edit-class-sec">
<ol id="cid0">
<li>
二级菜单
</li>
</ol>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
-----------------------------------
点击一级菜单,就把二级菜单显示到右边 ,然后获取二级菜单id 用FORM 表单提交到信息表里面
插入内容 以及二级id
-----------------------------
求大虾帮忙 --------------------编程问答-------------------- <form action="" method="post">
<table >
<tbody>
<tr>
<td>
<ul>
<li>
<ol>
<li class="tltle display-n"><a href="">一级菜单</a></li>
</ol>
</li>
<li class="edit-class-sub edit-class-sec">
<ol id="cid0">
<li>
二级菜单
</li>
</ol>
</li>
</ul>
</td>
</tr>
<tr>
<td>
内容<input type="text" />
</td>
</tr>
</tbody>
</table>
</form> --------------------编程问答-------------------- 如果用jquery 怎么获取到 内容 + 二级菜单id 进行判断,然后提交。 --------------------编程问答--------------------
<table >
<tbody>
<tr>
<td>
<ul>
<li>
<ol>
<li class="tltle display-n"><a href="http://www.baidu.com" target="myiframe">一级菜单</a></li>
</ol>
</li>
<li class="edit-class-sub edit-class-sec">
<ol id="cid0">
<li>
<a href="http://www.csdn.net" target="myiframe">二级菜单</a>
</li>
</ol>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<ifream src="" id="myiframe" name="myiframe" />
楼主是否要的这种效果?
是的话 在写2个页面 每个页面都有你需要的form表单
然后添加在a标签的href里就可以了。
--------------------编程问答--------------------
我也是这么做的…… --------------------编程问答-------------------- 仿照csdn树形菜单的么?
--------------------编程问答--------------------
<html>
<head>
<script>
function getChild(imageObject)
{
var tableTree = document.getElementById("tableTree");
var currentRow = imageObject.parentNode.parentNode;
var imageCount = currentRow.getElementsByTagName("img").length;
var currentRowIndex = 0;
for(currentRowIndex = 0;currentRowIndex < tableTree.rows.length;currentRowIndex++)
{
if(tableTree.rows[currentRowIndex] == currentRow)
{
break;
}
}
if(imageObject.src.indexOf("_plus1.gif") != -1)
{
imageObject.src = imageObject.src.replace("http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_plus1.gif","http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_minus1.gif");
var newTr = tableTree.insertRow(currentRowIndex+1);
var newTd = newTr.insertCell(0);
var imageStr = "";
for(var i = 0;i < imageCount;i++)
{
imageStr += "<img src='http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_line4.gif'/>";
}
newTd.innerHTML = imageStr + "<img onclick='getChild(this)' src='http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_plus1.gif'/>子节点";
}
else
{
imageObject.src = imageObject.src.replace("http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_minus1.gif","http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_plus1.gif");
for(var i = currentRowIndex+1;i < tableTree.rows.length;i++)
{
if(tableTree.rows[i].getElementsByTagName("img").length > currentRow.getElementsByTagName("img").length)
{
tableTree.deleteRow(i);
--i;
}
else
{
break;
}
}
}
}
</script>
</head>
<body>
<table id="tableTree" style="border:1px solid gray;border-collapse:collapse;width:100%;" cellpadding="0" cellspacing="0">
<tr>
<td><img onclick="getChild(this)" src="http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_plus1.gif"/>顶级节点</td>
</tr>
<tr>
<td><img onclick="getChild(this)" src="http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_plus1.gif"/>顶级节点</td>
</tr>
<tr>
<td><img onclick="getChild(this)" src="http://community.csdn.net/ui/scripts/System/_resource/MzTreeView/_plus1.gif"/>顶级节点</td>
</tr>
</table>
</body>
</html>
------------------------------
两边的数据已经显示出来了,只是怎么获取数据提交到数据呢?
补充:Java , Java EE