Welcome to the Geeks & God Static Archive. Read more »

dumb JS question

Joined: 11/28/2008

Hey all,

I'll post my entire beta page code below (it's not that much). What I'm trying to do here is have it so that when the user clicks the link, it will expand or shrink the div accordingly... This script will be used to show/hide a "more complete description"...

Thanks!

- Luke

CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<style>

.first {

    height : 200px;

    width : 500px;

    background-color : #3a3a3a;

}

</style>

<script language="javascript">

function explode(theName)

{

    var L = theName

    if(L.style){

 if(L.style.height == 200){

     L.style.height ="500px";

 }

 if(L.style.height == 500){

     L.style.height ="200px";

 }

    }

}

</script>

<TITLE> New Document </TITLE>

</HEAD>

<BODY>

<a href="#" onClick='explode("first");'>Click here</a>

<div class="first" id="first">text</div>

</BODY>

</HTML>

--
iLuke

Joined: 11/28/2008
Maybe you can use something

Maybe you can use something from here:

http://www.hotscripts.com/cgi-bin/jump.cgi?ID=21612

Joined: 11/28/2008
Wow gak, those effects are

Wow gak, those effects are properly awesome!

I was beginning to give up on JS, cause I'd only ever used it to do things that I now realise PHP can do much better and something like 11% of people browse with JS switched off, but those examples really expand the possibilities.

Thanks

Chris

Joined: 11/28/2008
Have you looked into a DHTML

Have you looked into a DHTML solution? Using "onclick" or some other mouse action you could call a javascript function that set's the DIV's CSS display to "none".

Joined: 11/28/2008
As is the case with most web

As is the case with most web dev stuff, this page has evolved (yet again!) I no longer need the JS, though I never did find a solution... Oh well, I'm too busy to play with it now, but maybe someday!

Thanks for the suggestions anyway guys!

- Luke

--
iLuke