在给定的例子,我要为#rightdiv
是最初的#rightdivOne
应显示在#rightdiv
和#rightdivTwo
或#rightdivThree
不应显示,然后在submit
按钮的点击,#rightdivTwo
应显示在的地方#rightdivOne
(以便#rightdivOne
不再可见),然后再点击submit
按钮,#rightdivThree
显示在同一个地方。Javascript:如何通过单击按钮在另一个div的位置显示div?
页面的其余部分应保持静态。
是否有可能通过Javascript来做到这一点?我无法使用AJAX。而且,我不喜欢使用JQuery,只会将其用作最后的手段。 如果这是可能的,有人可以指导我如何?
<div id="leftrightdiv" style="width:380px; padding-left:10px; padding-right:10px; background-color:grey; height:400px;">
<div id="leftdiv" style="width:190px; float:left; overflow:auto; background-color:#7bbe7b; height:400px;"></div>
<div id="rightdiv" style="width:190px; float:right; overflow:auto; background-color:#87ccd1; height:400px;">
<div id="rightdivOne" style="width:100%; float:right; background-color:#25dcea; height:400px;">
<p>I am the statement of the question. I am the statement of the question. I am the statement of the question. I am the statement of the question. </p>
<div><input type="radio" name="radiorightdivTwo" value="Option One">
<label>Option One</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Two">
<label>Option Two</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Three">
<label>Option Three</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Four">
<label>Option Four</label></div>
<span style="float:right; margin:50px;"><input type="submit" value="Submit"></span>
</div>
<div id="rightdivTwo" style="width:100%; float:right; background-color:#d1879b; height:400px;">
<p>I am the statement of the question. I am the statement of the question. I am the statement of the question. I am the statement of the question. </p>
<div><input type="radio" name="radiorightdivTwo" value="Option One">
<label>Option One</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Two">
<label>Option Two</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Three">
<label>Option Three</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Four">
<label>Option Four</label></div>
<span style="float:right; margin:50px;"><input type="submit" value="Submit"></span>
</div>
<div id="rightdivThree" style="width:100%; float:right; background-color:#8f63f2; height:400px;">
<p>I am the statement of the question. I am the statement of the question. I am the statement of the question. I am the statement of the question. </p>
<div><input type="radio" name="radiorightdivTwo" value="Option One">
<label>Option One</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Two">
<label>Option Two</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Three">
<label>Option Three</label></div>
<div><input type="radio" name="radiorightdivTwo" value="Option Four">
<label>Option Four</label></div>
<span style="float:right; margin:50px;"><input type="submit" value="Submit"></span>
</div>
</div>
</div>
注: - 我使用内联CSS的一个原因。所以请不要在此基础上。
请出示我们尝试过的JavaScript,并让我们知道出了什么问题。 – showdev 2014-09-12 20:40:11
@showdev我没有尝试任何东西。我不知道该怎么做,该怎么做。所以如果有人能给我一个线索,你可以通过使用这个来做到这一点,然后做这件事,我可以写一些JS代码和Google的东西。 – Solace 2014-09-12 20:57:57
@showdev我只知道它可以使用卡布局在Java中完成,所以它也必须可以在Web应用程序中使用(并且我已经看到带有动态内容的应用程序),所以必须有一种方法。我需要知道那是什么。 – Solace 2014-09-12 20:59:14