1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest Last month we upgraded BlackHatWorld.com to a new platform - . If you notice anything that requires attention please start a new thread here.
    Dismiss Notice

JavaSCript Question

Discussion in 'HTML & JavaScript' started by EmailMaster, Jan 25, 2013.

  1. EmailMaster

    EmailMaster Jr. VIP Jr. VIP Premium Member

    Joined:
    May 28, 2011
    Messages:
    1,390
    Likes Received:
    511
    Occupation:
    Proxy & Account Seller
    Location:
    Canada
    Hi,

    Im new to javascript

    This is what im trying to do. On my html page I have to have 4 different font sizes one thats 10px 20px 30px 40px then reset

    When i click or rollover on 10px the font size changes and displays the new size of the font in the Div Box.

    Also I have an input box so when i type in the input box and press submit it shows the text you typed in and displays it within the div box with the font assigned in the css.

    Thanks
     
  2. 312k1t

    312k1t Registered Member

    Joined:
    Oct 26, 2012
    Messages:
    51
    Likes Received:
    4
    I am not sure what you need. With Javascript you can access to DOM. DOM is represenation of your html code. So you can access to every html tag (like <input ... /> ...) and do almost everything.

    In the example below. There is input element and in javascript I get element by ID and get atribute value of this element and print it to alert window. There is a lots of examples on internet.
    Code:
    <input id="myid" value="value" type=".." />
    
    <script>
    var inputElement = getElementById("myid");
    var value = inputElement.getAttribute('value');
    alert(value);
    </script>
    
     
  3. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,412
    Likes Received:
    9,797
    Is this your homework? :)
     
    • Thanks Thanks x 3
  4. EmailMaster

    EmailMaster Jr. VIP Jr. VIP Premium Member

    Joined:
    May 28, 2011
    Messages:
    1,390
    Likes Received:
    511
    Occupation:
    Proxy & Account Seller
    Location:
    Canada