By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.