Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turning On Submit Images

Status
Not open for further replies.

iggit

Programmer
May 20, 2001
47
US
Situation:
1 Master button (type=image) (call this 'on')
3 Slave buttons.. (type=image) (call them 1,2,3)

When on is clicked it allows
1 2 and 3 to be clicked
uinless 'on' is clicked 1 2 and 3 cannot be clicked

now... if I had one simple clue as to how
to pull this off ....

buttons can be form buttons or url linked images
with fields as each button sends data to a perl script
but buttons 1 2 and 3 cannot be pused (by design)
until button 'on' is pushed...

I could do this with tracking the 'on' click when it
sends data to perl script #1 but I can't have buttons
1 2 and 3 read that data since those buttons are already
loaded.. I could do them as iframes and refresh that
data and that would work fine but iframes are getting
crowded already...

does anyone please have an idea how to do this???

thank you in advance for your kind patience in
putting up with this request
 
The first thing that comes to my mind is using "innerHTML." If you aren't familiar with the inner workings (pun intended!) with that, just do a search for it on your favorite JavaScript tech site.

In a nutshell, here's how it works:
The code that changes will have to be inside some kind of a container (like a division, span, table row, etc.) and you'll give that container a name or an ID or both. Then you write a script which replaces the code inside that container when your "ON" image is clicked.

<a onClick=&quot;turn_me_on_dead_man()&quot;>image1</a>

<div name=&quot;walrus&quot; id=&quot;walrus&quot;>image2 image3</div>

<script>
function turn_me_on_dead_man() {
document.getElementById(&quot;walrus&quot;).innerHTML = &quot;<a href='something.htm'>image2</a> <a href='somethingelse.htm'>image3</a>&quot;
}
</script>

Bottom line... when the page first loads there are no links associated with the images but as soon as the &quot;ON&quot; image is clicked the links are written to the page.
 
Thank you very much sir.
Shall give it a major try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top