我有一个页面,home.php
。在页面上,我有CSS选项卡tab1
和tab2
。这些标签在同一页面上不是不同的页面。我想要tab2
的内容显示,只要我点击tab2
的内容中的提交按钮,不要把我带回tab1
。我如何使用JavaScript来实现这种行为?如何在单击按钮时显示标签的内容
<html>
<head>
<title>home</title>
</head>
<link href="SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<body>
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">Tab1</li>
<li class="TabbedPanelsTab" tabindex="0">Tab2</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
//this is where the content of the tab1 will be and i have another form in this content too
</div>
<div class="TabbedPanelsContent">
//this is where the content of the tab2 will be
<form action="home.php" method="post">
<?php
if (isset($_POST['submit'])) {
if(empty($_POST['boded']){
echo"Please do it again.";
}else{
$mgs = ($_POST['boded']);
//then insert to my database
}
?>
<textarea id="message" name="boded" rows="5" cols="40"></textarea>
<input type="submit" name="submit" value="Submit" />
//if i click this button(submit) in this content it should display tab2 content not tab1
</form>
</div>
</div>
</body>
</html>
我试过第一个人问我要做什么;它的工作原理,但有一个问题:提交按钮并没有发送到$_POST['submit']
是否因为我的按钮(<input type="submit" name="submit" value="Submit" onClick="show_content('div_2'); return false;"/>
)中的假我秋天我提到在tab2
内容我有一个PHP代码,接收按钮发送给它。
以上是我重新编辑的代码,如果您在编码上编辑,我将非常感激。
请修复您的代码粘贴(缩进4空格或使用ctrl + k选项) – drudge 2010-10-28 18:52:34
另外,请为您的问题添加一些标点符号和大写字母。我很确定那里肯定有不止一句话。 – kindall 2010-10-28 19:08:17