Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javacript Novice

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #242246
    web_junkie
    Participant

    First of all i want to recommend your works and efforts towards making everyone equal in the sense of offering assistance.

    I came across this site as i was reading a book on css animation and transition. I just decided to follow the link if i could get more css tutorials and tips little did i know that this site has solution to my problem.

    Sincerely, i started learning web develpment some months ago but am stuck with this language called javascript. I have read and watched tutorials but that’s the more confused i became…

    Please can someone help explain how i link my div id or div class to this javascript stuffs… Thanks in anticipation….

    #242248
    Senff
    Participant

    You’ll need to be a little more specific about what you want, really. “Link my div to Javascript stuffs” doesn’t really mean much.

    But then, when we would explain something to you, the key is to actually understand it. And that’s where basic Javascript knowledge comes in, so watching/reading tutorials is still important!

    #242251
    web_junkie
    Participant

    @Senff, thanks for your reply. The truth is i don’t seem to understand the javascript. the more i try to understand the hell it becomes..

    #242252
    Shikkediel
    Participant

    What would you like to achieve? It is merely purpose driven. Any HTML elements in your page can be manipulated with JS… in countless ways. But you must have some reason for it.

    #242309
    web_junkie
    Participant

    I find it hard understanding javascript… dunno why it’s like that..

    Just need a suitable material that explains it better..

    #242323
    bearhead
    Participant

    I find that I learn programming languages most efficiently by doing.

    Start with a small project and build from there.
    Maybe something like this:

    create a script that changes the text of a button when the user clicks it.

    To do that you’ll need to know:
    How to select an html element in javascript
    How to call a function on click
    How to change the inner html of an element

    off to google with you!

    #242331
    amanda_
    Participant

    You’ve been learning for a few months?? get a good handle on HTML and CSS for a few more months and then try Javascript.

    #242453
    web_junkie
    Participant

    Thanks… just decide to leave javascript and concetrate more on css and html..

    it seems php is a lot easier than javascript…


    @AMANDA
    … thanks ma’am

    #242455
    rkieru
    Participant

    While I agree with everyone else in that you would benefit on firming up your fundamentals on HTML/CSS before trying to tackle Javascript, I would advise you to eventually look up “Selectors”, as that is the terminology that you are looking for regarding how to have Javascript interact with specific Classes and IDs.

    For example, in jQuery it might look like this:

    $(".btn-action").hide();

    In jQuery, this would take all instances where the class .btn-action was applied and hide that element.

    #242457
    I.m.learning
    Participant

    PHP is only going to get you so far.
    You seem to know that PHP is server-side; you need to provide it for your users when the page loads. JavaScript is built into the browsers and are mainly client-side that can be run after a page loads.

    If you require something that is to be run after a page loads; PHP fails every time. Most JavaScript are pre-written, you just need to call upon those codes.

    JavaScript has a library called JQuery in which we can download it to our local environment, or link to it through various sources.
    Many sites use
    https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js”

    As Shikkedielsaid, “it’s purpose-driven.”
    Meaning, what are you looking to do?
    What do you do with your PHP?

    How about an example for both- for the time:

    PHP you do what, create a variable, and use some code? Okay..

    <?php
    $t=time();
    echo($t . “<br>”);
    echo(date(“Y-m-d”,$t));
    ?>

    So, as soon as the page loads, it’s there.

    But what if you don’t want the time to be displayed as soon as the page loads?
    What if we want the user to initiate it, at their own discretion? Well, that’s where JavaScript comes in. Let’s create a button the user clicks to initiate the code

    <button type=”button”
    onclick=”document.getElementById(‘time).innerHTML = Date()”>What’s the Time?</button>

    As soon as the user clicks the button, the time is displayed.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.