开发者

Is it possible to write the 2 html codes in the same html file?

Is it possible to write the 2 html codes in the same html file and call it when required with help of nam开发者_高级运维e property

<html name ="abc1">
<body>
</body>
</html>

<html name ="abc2">
<body>
</body>
</html>

Thanks in advance - Miss subanki


I don't believe that is valid. Depending on what you're doing, couldn't you just do the same things with div tags?

<html>
  <body>
    <div id="abc1">
      <!-- Content goes here -->
    </div>

    <div id="abc2">
      <!-- Content goes here -->
    </div>
  </body>
</html>


You can use a scripting language if you want to add conditions like these.

PHP example for page.php?show=abc1

<?php
if ($_GET['show'] == 'abc1') {
  echo 'something';
} elseif ($_GET['show'] == 'abc2') {
  echo 'something else';
}
?>


I agree with Alec's post that you should probably use a Server Side Scripting (http://www.w3schools.com/web/web_scripting.asp) to achieve what you are trying to do. It sounds like you are taking users input and deciding what to show them.

So a very high general overview of how server side scripting works is you generate a page request with information from the user and then on the server side, a script parses the url and decides based on the parameters passed in, what to show the user.

The desired effect of showing one section at a time can also be achieved through Javascript or any client side scripting - http://www.w3schools.com/js/default.asp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜