Where does PHP code get executed?. Where does JavaScript get executed?

Preview:

Citation preview

Where does PHP code get executed?

Where does JavaScript get executed?

There are many alternatives to PHP such as Ruby, Python, ASP, etc.

What are the alternatives to JavaScript?

Is jQuery a language? Explain.

The jQuery selector syntax $(“#myid”)

is modeled after which language?

Which one of these is pure JavaScript and which is jQuery

a. document.getElementById(“x”).setAttribute(“style”, “color: red”);

b. $(“#x”).css(“color”, “red”);

Why is the jQuery considered “better?” List two reasons.Why is the pure JavaScript “better?” List two reasons

a. document.getElementById(“x”).setAttribute(“style”, “color: red”);

b. $(“#x”).css(“color”, “red”);

Document.getElementById(“x”).setAttribute(“style”, “color: red”);

1. Wordier2. Easier to make difficult to debug syntax errors

$(“#x”).css(“color”, “red”);

1. Requires including jquery.js2. Easier to make difficult to debug syntax errors

Which of these is most likely PHP

a. $xb. $(“x”)c. var x

Identify the HTML, CSS and JavaScript in this code

<button onclick=“processForm()” style=“border: 1px solid red”>OK</button>

Identify the PHP HTML, CSS and JavaScript in this code

echo ‘<button onclick=“processForm()” style=“border: 1px solid red”>’.$label.’</button>’;

In JavaScript why is it better to apply an event listener or event

handler, rather than use an attribute as show below?

<button onclick=“processForm()” style=“border: 1px solid red”>OK</button>

More generally why is it important to separate HTML and JavaScript?

Where can JavaScript code be defined?

a. In a <script> tag anywhere in an HTML document.b. Directly in the <head> of an HTML documentc. In a separate “.js” file that is then included using the <script>

tag.d. In certain HTML attributes such as “onclick” or “onload”e. In a PHP file, assuming the JavaScript code is properly

outputted inside a web page

Where would you store a user’s password in a typical web

applicationa. In a file on the serverb. In a database table, hopefully an encrypted fieldc. As a PHP variabled. In a $_SESSION variablee. In the browser cookief. As a JavaScript variable

Where would you NOT store a user’s current running score in a

typical web-based gamea. In a file on the serverb. In a database table, hopefully an encrypted fieldc. As a PHP variabled. In a $_SESSION variablee. In the browser cookief. As a JavaScript variable

Where would you store a user’s historical high scores in a typical

web-based gamea. In a file on the serverb. In a database table, hopefully an encrypted fieldc. As a PHP variabled. In a $_SESSION variablee. In the browser cookief. As a JavaScript variable

Which language allows us to select, delete, insert and update information that is stored in a web application's underlying database?

a. Circle one: Front-end Back-end Communication

Which framework is used to pass information between a web server and web browser

without needing to refresh the entire web page?

a. Circle one: Front-end Back-end Communication

Which HTML attribute is primarily used to apply CSS to two or more elements so they share the same style?

• Which HTML attribute is used by JavaScript to get a unique element so it can be fetched/manipulated?

• Which HTML attribute is used to identify form elements for traditional GET and POST form submission?

• It is often better to generate HTML with a program rather than type it manually (hard coding), even for things that are not dynamic, i.e., will not change. What is one of the major advantages of creating HTML code programmatically that has nothing to do with the content being dynamic?

• Write the code so that any element with class="important" will display the alert message "this is important" if the element is clicked.

• In general, what are the main reasons for using client-side processing instead of server-side processing?