Draw a picture of how the following HTML and CSS code will look when the browser renders it onscreen. Indicate a background coloring by shading lightly or by drawing repeated diagonal lines like . Assume that stickman.png
is a generic picture of a stick man.
HTML |
---|
CSS |
Write the Javascript code to accompany the following HTML code, so that when the Delete button is clicked, any button whose text value is divisible by the number written in the text field is removed from the page. You may assume that a valid number has been typed in the text field. The HTML code is the following:
For example, after typing the number 2 into the text field and pressing Delete, the following should be the page appearance:
Write the Ajax Javascript code to fetch and display XML data from the file named movie.xml
(in the same directory as your code). This file contains lines spoken by a character in a movie. Your code should process the XML and display the character's lines, each in its own paragraph, in the format shown below. Assume that the code will execute on an HTML page containing a div
with the CSS ID of q3html
, and insert the paragraphs into this div
.
The XML data will be in a format that matches the following abbreviated example:
<character name="Captain Jack Sparrow" actor="Johnny Depp"> <line time="02:55">Captain Jack Sparrow, if you please, sir.</line> <line time="3:21">I'm in the market as it were.</line> ... <line time="2:41:38">On deck, you scabrous dogs! Man the braces! Let down and haul to run free. Now... bring me that horizon. And really bad eggs? Drink up, me 'earties, yo ho.</line> </character>
For the XML data above, your code would produce the following content on the HTML page:
(02:55) Captain Jack Sparrow, if you please, sir.
(3:21) I'm in the market as it were.
(2:41:38) On deck, you scabrous dogs! Man the braces! Let down and haul to run free. Now... bring me that horizon. And really bad eggs? Drink up, me 'earties, yo ho.
Write PHP code that processes the following form:
<form action="q4.php" method="post"> <fieldset> <input type="text" name="name" /> Name <br /> <input type="text" name="pw" /> Password <br /> <input type="text" name="cc" /> Credit Card Number <br /> <input type="submit" /> </fieldset> </form>
(Onscreen, the form looks like this:)
Your code should examine the name, password, and credit card number submitted, and verify that they are valid. A valid name is any non-empty string. A valid password is any string that is at least 6 characters long. A valid credit card number contains exactly 16 digits. Optionally, the credit card number can contain dashes between some or all groups of four digits. No other characters may be part of a credit card number. For example, the following are some examples of valid and invalid credit card numbers:
Valid | Invalid |
---|---|
1234567812345678 2457-1543-4367-4093 39485098-81902375 9834-34256678-9827 |
2457.1543.4367.4093 foo1234567812345678 12345678123456789 1234-5678-1234-5678- 12-34-56-78-12-34-56-78 |
Your PHP code's output should be a two lines of text, the first stating whether the data was valid or invalid, and the second containing the data itself separated by commas. Replace the password by a string of *
characters of equivalent length. Strip any dashes out of the credit card number while displaying it. For example, here are some outputs of your script for various form input:
Form Input | Output |
---|---|
Marty booyah! 1234-5678-1234-5678 |
Successful. Marty, *******, 1234567812345678 |
Kenneth hulk 11112222-33334444 |
Denied! Invalid data. Kenneth, ****, 1111222233334444 |
Jeff quailman 4321-4321x-4321-43210 |
Denied! Invalid data. Jeff, ********, 43214321x432143210 |
Use regular expressions for pattern matching and replacement.
Write an SQL query that will return the names of all characters that appeared in two or more of the Pirates of the Caribbean movies; that is, movies whose name contains the substring "Pirates of the Caribbean". Ensure that the results are returned in alphabetical order. If it helps you, you may assume that the character is played by the same actor in both movies. The following is a subset of the results returned:
+-------------+ | role | +-------------+ | Himself | | Marine | | Will Turner | +-------------+ 3 rows in set (2 min 38.73 sec)
Recall that the imdb
database contains the following tables:
id | first_name | last_name | gender |
---|---|---|---|
433259 | William | Shatner | M |
797926 | Britney | Spears | F |
... |
id | name | year | rating |
---|---|---|---|
112290 | Fight Club | 1999 | 8.5 |
210511 | Memento | 2000 | 8.7 |
... |
actor_id | movie_id | role |
---|---|---|
433259 | 313398 | James T. Kirk |
797926 | 342189 | Herself |
... |