where does php code get executed?. where does javascript get executed?

25
Where does PHP code get executed?

Upload: junior-simon

Post on 04-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Where does PHP code get executed?. Where does JavaScript get executed?

Where does PHP code get executed?

Page 2: Where does PHP code get executed?. Where does JavaScript get executed?

Where does JavaScript get executed?

Page 3: 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?

Page 4: Where does PHP code get executed?. Where does JavaScript get executed?

Is jQuery a language? Explain.

Page 5: Where does PHP code get executed?. Where does JavaScript get executed?

The jQuery selector syntax $(“#myid”)

is modeled after which language?

Page 6: Where does PHP code get executed?. Where does JavaScript get executed?

Which one of these is pure JavaScript and which is jQuery

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

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

Page 7: Where does PHP code get executed?. Where does JavaScript get executed?

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”);

Page 8: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 9: Where does PHP code get executed?. Where does JavaScript get executed?

Which of these is most likely PHP

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

Page 10: Where does PHP code get executed?. Where does JavaScript get executed?

Identify the HTML, CSS and JavaScript in this code

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

Page 11: Where does PHP code get executed?. Where does JavaScript get executed?

Identify the PHP HTML, CSS and JavaScript in this code

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

Page 12: Where does PHP code get executed?. Where does JavaScript get executed?

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>

Page 13: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 14: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 15: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 16: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 17: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 18: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 19: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 20: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 21: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 22: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 23: Where does PHP code get executed?. Where does JavaScript get executed?

• 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?

Page 24: Where does PHP code get executed?. Where does JavaScript get executed?

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

Page 25: Where does PHP code get executed?. Where does JavaScript get executed?

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