Jump to content

Opening block to the side

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
bleastan

bleastan

    Learning Programmer

  • Members
  • PipPipPip
  • 40 posts
Hello peoples ive been recently experimenting a bit with javascript and got it to work that a block of text expands down however what i would like to do is make it expand to the site. Its hard to explain in just text so heres the code.


<html><head>

<style type="text/css">

#tekst {

display: none;

width: 700px;

border: 1px solid black;

background-color: #cccccc;

padding: 5px;

font-size: 12px;

}

</style>


<script type="text/javascript">

  function kadabra(zap) {

   if (document.getElementById) {

   var abra = document.getElementById(zap).style;

    if (abra.display == "block") {

    abra.display = "none";

    } else {

    abra.display= "block";

   }

   return false;

   } else {

   return true;

  }

  }

</script>

</head>


<body>

This is text

<a href="#" onclick="return kadabra('tekst');"> Link to the text</a>

<p id="tekst">

this comes in the box.

</p>

<p>stuff below !</p>

</body></html>


when u click the link the box with text comes below the link. What i would like is that the box opens op next to the link (so to the right side). Can anyone assist me in how to accomplish this, ive looked around but cat really find it. Thx in advance.

#2
bleastan

bleastan

    Learning Programmer

  • Members
  • PipPipPip
  • 40 posts
Found solution so the thread can be closed :)

#3
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
I would like to see the solution...
Just a tip:
As long as the post isn't to old i recommmend posting how you fixed so other people don't have to make new threads asking the same thing.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).