Web technology (eg.javaScript)

Cards (32)

  • what html tag would you use to add some JavaScript to a webpage
    <script>
  • what data structure is this(in JavaScript)
    data say_hello(){data say_hello(){
    —alert (”hello”);
    }
    function
  • What does this code do(JavaScript )
    <button onclick = ”say_hello()”>press me </button>
    When the button is clicked it does the function of “say_hello”
  • how do you define a variable of age that is 17
    var age = 17;
  • what data structure is this:
    if(age >18){
    —alert(“yep”);
    }else{
    —alert(“Narp ”);
    }
    if statement
  • what data structure is this:
    for (var i = 0<5,i++){
    — document.write(“yay”);
    }
    For loop
  • what data structure is this:
    var i =0;
    while (i <5){
    —document.write(“yay”);
    —i++;
    }
    while loop
  • what is data structure is this:
    var colours = [“red”,”orange”,”yellow”];
    array
  • how would you add another element to an array in Java Script
    push function
  • what are all on Java script subroutiness called
    function
  • what does this code do (Java script):
    alert(“hello”);
    makes an alert box that says hello
  • what does this code do ?:
    <script>
    var result = 2 + 3;
    document.write(result);
    </script>
    it adds 2 + 3, then it outputs it directly on the page
  • what does this code do?:
    <h1 id = “example”> page heading</>
    <script>
    choosen_element = document.getElementById(“example”);
    choosen_element.innerHTML = “hello world”;
    </script>
    A h1 element is created and tagged as “example”
    Then the Java script makes a referent to that element (choosen_element) and changes its html inside the tags to “hello world”
  • the main tags in HTML:
    • HTML
    • Head
    • body
    • Link
    • Title
    • Div
    • H1,H2 etc
  • How would you add an image called “cat.jpeg”, and width and length are both 100 pixels(in HTML)
    <img src = “cat.jpeg” width = “100”
    Height = “100”>
  • How would you add a link: (HTML)
    <a href = “https://www.website.com”> whats shown</a>
  • how do you add a list with numbers(HTML)
    <body>
    —<ol>
    —-<li>number 1 </li>
    —-<li>number 2 </li>
    —-<li>number 3 </li>
    —</ol>
    </body>
  • Why would you use CSS
    • Define the formating
    • To change formating
    • Consistency
  • What is this called?(CSS)
    #myheader {
    Colour:white;
    }
    Used by Doing:
    <h1 id = “my header”…></h1>
    ID selector
  • what is this called :(CSS)
    .city {
    colour:white;
    }
    used by <h2 class = “city”></h2>
    class selector
  • How would you make all of the h1,h2 and p text all red?
    h1, h2 , p{
    —color:red;
    }
  • What are the three ways to insert css?
    • External
    • Header / internal
    • Inline
  • to use external css you would need to use the tag:
    <link rel = “stylesheet” href = “mystyle.css”>
  • internal/header css can only be used on HTML page
  • what tag would you use to add header/internal css?
    <style>
  • what would internal/header and external css look like?
    *any other tags here
    body{
    —background-colour :white ;
    }
  • inline css is used on one element and one file
  • how would you make a h1 blue?
    <h1 style = “color:blue;”> this is a heading</h1>
  • cascading order
    if there is more than one style specified for a HTML element it will follow this priority order:
    1. inline style
    2. external and internal/header
    3. browser default
  • to add a comment to css you would use:
    /*comment goes here*/
  • to add a comment to HTML you would use:
    <!— comment goes here —!>
  • in css you can use rgb for colours by:
    rgb(red,green,blue)