Results 1 to 1 of 1

Thread: Noob Javascript question

  1. #1
    Join Date
    Aug 2009
    Posts
    59

    Noob Javascript question

    So I'm still new at Javascript and have been doing a lot of reading and tutorials on W3schools. So I decided to try adding javascript to a page that I created with html/css to make it look more dynamic. Basically I want some tabs to move when clicked.

    The problem is nothing happens when I click on the tab. I tested and I've been able to change other styling aspects of the anchor, like I can set the display to "none". But when it comes to the "left" positioning, I can't seem to change the value of it. Eventually I want it to slide, but for now I'm just trying to get it to move at all on a click.


    I have some css styling and html on the page but nothing complicated. I'm sure I'm forgetting something basic and important to make the events work but I can't seem to figure it out.

    I can manipulate other aspects of the style but the "left" aspect doesn't seem to work at all when I try to change it.

    Here is the html;
    "<li ><a href="#" id="newstab" onclick="moveRight('newstab')"><span class="tabtext" >News</span></a></li>"
    css;
    "#newstab {
    position:absolute;
    display:block;
    width:80px;
    height:60px;
    text-indent:-10000px;
    background:url(tab-news.png) no-repeat;
    top:48px;
    left:0px;
    }
    #newstab:hover {
    background:url(tab-news-hover.png) no-repeat;}"

    and javascript;
    "<script type="text/javascript" language="javascript">
    var i=0
    function moveRight(eleID)
    {
    i=+3;
    document.getElementById(eleID).style.left=i;
    }
    </script>"
    Last edited by darkray16; 18 Oct 2009 at 05:20 PM.

Similar Threads

  1. noob question, how to: php mailer
    By google in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 18 Jul 2009, 08:26 PM
  2. Noob with frames question
    By mulpsy in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 09 Mar 2007, 03:13 PM
  3. Javascript question
    By Tharnid in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 23 Sep 2005, 07:54 AM

Posting Permissions

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