Results 1 to 2 of 2

Thread: Using div?

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    Using div?

    Hello, I have a webpage where i want to have some kind of text that should change when i click on a picture. I thought of using div's and then using its innerHTML property to set the text to the new value but it is not actually working.

    function LOL(teste) {
    var div = document.getElementById(teste);
    div.innerHTML = "blablabla";
    by some stupid reason it works on IE but in firefox it will change and in the same moment will change back to the old value. Any ideias why or how to do this in another way? Thanks in advance
    \m/\m/

  2. #2
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Re: Using div?

    How are you calling the function? This seems to work for me:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function WriteText(el)
    {
    	var div = document.getElementById(el);
    	div.innerHTML = "blablabla";
    }
    </script>
    </head>
    <body>
    <img src="http://vbforums.com/images/misc/subscribed.gif" onclick="WriteText('boo');" width="15" height="15" border="0" id="xxx">
    <div id="boo">
    aasl;dkfjas;ldfkasd
    </div>
    </body>
    </html>
    Good luck;
    {yak}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width