change text in javascript
Results 1 to 3 of 3

Thread: change text in javascript

  1. #1
    Senior Member
    Join Date
    Jan 2002
    Posts
    227

    change text in javascript

    Hi guys...

    I tried to write a little script that changes a text in div element every time i put my mouse over a link... I have something like this


    the script:
    <script language='text/javascript'>
    function zmentext(text)
    {
    document.all.popisek.innerHTML = text;
    }
    </script>

    link:
    zmen to

    and div element:
    <div ID="popisek" style='position:relative; top:0; left:40;'>huhuhuu</div>
    but every time I place my mouse over the link I get object expected error... What am I doing wrong?

    Thank you all for your answers
    http://promote.opera.com/small/opera94x15.gif

    [gloworange]Sun7dots[/gloworange]

  2. #2
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    Here's what I came up with. I don't know Javascript so I kept changing things till it worked. I couldn't get it to take in a variable.
    Code:
    <script language="JavaScript" type="text/javascript"> 
    
    function zmentext() 
    { 
    document.all.popisek.innerHTML = "jsemtu"; 
    } 
    </script> 
    
    
    zmen to 
    
    
    <div ID="popisek" style='position:relative; top:0; left:40;'>huhuhuu</div>
    edit
    just got it:
    Code:
    <script language="JavaScript" type="text/javascript"> 
    var text;
    
    function zmentext(text) 
    { 
    document.all.popisek.innerHTML = text; 
    } 
    </script> 
    
    
    zmen to 
    
    
    <div ID="popisek" style='position:relative; top:0; left:40;'>huhuhuu</div>

  3. #3
    Senior Member
    Join Date
    Jan 2002
    Posts
    227
    Thank you! I tried to change everything possible to make it work, but I didn't trie to change the <script tag Thank you one more time and points to you
    http://promote.opera.com/small/opera94x15.gif

    [gloworange]Sun7dots[/gloworange]

Posting Permissions

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