subanki
subanki

Reputation: 1429

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 name property

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

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

Thanks in advance - Miss subanki

Upvotes: 0

Views: 97

Answers (3)

Eric
Eric

Reputation: 2268

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

Upvotes: 0

Ken Earley
Ken Earley

Reputation: 769

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>

Upvotes: 1

Alec
Alec

Reputation: 9078

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';
}
?>

Upvotes: 0

Related Questions