<DIV> tag switch-back-and-forth question

M

Matthew

Hello! What is the best NS/IE compliant way to accomplish this using
the least amount of javascript code?

<div id="block1">
Group 1 Code
</div>

<div id="block2">
Group 2 Code
</div>

<a id="buttonone" href="javascript:somecode()">Button One</a>
<a id="buttontwo" href="javascript:somecode()">Button Two</a>

Ok, I know those <div> tags may not be formed correctly, but what I
want is for 'Group 1 Code' to run by default, and then the user can
click either button to execute the corresponding <div> tag.
 
F

Fabian

Matthew hu kiteb:
Hello! What is the best NS/IE compliant way to accomplish this using
the least amount of javascript code?

<div id="block1">
Group 1 Code
</div>

<div id="block2">
Group 2 Code
</div>

<a id="buttonone" href="javascript:somecode()">Button One</a>
<a id="buttontwo" href="javascript:somecode()">Button Two</a>

Ok, I know those <div> tags may not be formed correctly, but what I
want is for 'Group 1 Code' to run by default, and then the user can
click either button to execute the corresponding <div> tag.

What do you mean by execute? Conventionally, it is html that is
contained within a div tag, and html is not known for its potential to
be executed.
 
L

Lasse Reichstein Nielsen

Hello! What is the best NS/IE compliant way to accomplish this using
the least amount of javascript code?

This? ... OH! The important part of your question was only in the
subject. Don't do that! It makes your posting hard to read.
<div id="block1">
Group 1 Code
</div>

<div id="block2">
Group 2 Code
</div>

<a id="buttonone" href="javascript:somecode()">Button One</a>

<a id="buttontwo" href="javascript:somecode()">Button Two</a>

Ok, I know those <div> tags may not be formed correctly, but what I
want is for 'Group 1 Code' to run by default, and then the user can
click either button to execute the corresponding <div> tag.

The contents of DIV elements is HTML code. You don't execute that, you
show it (it is a description language, not a programming language).

Try to explain your problem more precisly. Ignore, for now, how you
expect or want to solve it, just explain the problem. (E.g., "I want
people to be able to select what happens when they <floodleboodle> on
the page. Either <foo> happens, or <bar> does. Selecting should be done
by clicking in one of two places")

(Then I would suggest to use buttons for the clickable places, not
links, and for the rest, I would need to know what <floodlebodle>,
<foo>, and <bar> are)

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top