470,647 Members | 1,188 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

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

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.
Jul 20 '05 #1
2 3411
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.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #2
ma******@yahoo.com (Matthew) writes:
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>
<URL:http://jibbering.com/faq/#FAQ4_24>
<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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul Thompson | last post: by
2 posts views Thread by Zarkas | last post: by
1 post views Thread by Speedy | last post: by
5 posts views Thread by chakradhari.ashish | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.