Ajax Dice Game Part 1. We saw that we could use the jQuery load() function, to dynamically load a piece of an html document into another html document.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

the Internet browser of choiceVidor ISD What is Internet Explorer? a Web browser* produced by the Microsoft Corporation *a software application used.
Green Eggs and Ham Rhyming words file folder game The Teacher should print 1 copy of page 1 and print two copies of page 2 and 3 Laminate page 1 to the.
Advanced Web Design Using Dreamweaver Robby Seitz 121 Powers Hall
The dos and don’ts. 1. Be sure to put the title of the text somewhere on the page where the reader will notice it. 2. Pull out 2 or more significant quotes.
9.7 Probability Mutually exclusive events. Definition of Probability Probability is the Outcomes divided by Sample Space. Outcomes the results of some.
Probability And Expected Value ————————————
Creating & Attaching CSS An CSS Primer Tutorial. A New CSS Document Create a new CSS Document in Dreamweaver using the “New” option under the File Menu.
JMD2144 – Lesson 5 Web Design & New Media. ‘Div’ide and conquer One of the most versatile structure tags available is the.. tag Short for ision, it allows.
Javascript & HTML5 Intro. Why Javascript? Next big thing in online games Flash is slowly on its way out Can be coded via any text editor, flash costs.
HTML. We’ll learn … What HTML is What tags are What a basic web page looks like What 3 HTML tags are required What HTML comments look like How to title.
ITM352 PHP and Dynamic Web Pages: Server Side Processing.
Win8 on Intel Programming Course Modern UI : Features Cédric Andreolli Intel Software.
JQuery Page Slider. Our goal is to get to the functionality of the Panic Coda web site.Panic Coda web site.
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
Server-side Scripting Powering the webs favourite services.
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
1 Essential HTML coding By Fadi Safieddine (Week 2)
Bill's Amazing Content Rotator jQuery Content Rotator.
How to use the internet The internet is a wide ranging network that thousands of people use everyday. It is a useful tool in modern society that once one.
You are going to work in pairs to produce a Maths board game.
Webpages & HTML Sara Imam HTML! What??? HTML is a type of code language that a computer can understand & turn into a webpage design. HEH??? ?
Week 1 – Beginners Content McAfee & Big Fish Games CoderDojo.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
Images Worksheet. Web template Download the template folder Unzip and save in your documents Rename the folder to “images work” without quotes.
Dawn Pedersen Art Institute. What Are CSS Sprites? Back in the day, sprites were the images in games that swapped one little image for another in a specific.
Week 2: Building a Simple Website IMC 320 Web Publishing Spring 2011.
PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP.
The Web Browser Button Game Click to play Click to play.
Putting it all together: A web designers workflow.
Model with Arrays MAFS.3.OA.1.1, MAFS.3.OA.1.3. Model with Arrays How could you model 3 x 4?
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
Random Name Picker. Instructions 1.Either enter a list of new names or load a set previously saved names by clicking the load button. 2.Click start. Known.
Basic HTML swap with AJAX. Lets get our beloved html for our llama site. Open the index.html page and add a class to our navigation links. Then lets add.
KompoZer. What is it? A FREE product used to design websites A FREE product used to design websites A WYSIWYG HTML Editor A WYSIWYG HTML Editor –WYSIWYG:
Database to HTML and Back again A programmers tale.
Chapter 1 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
Back to the Web Alice Wrap-Up. Update your Class Web Page  In the index.html change the “Client Sites” section to: Alice 1. Basics of Computer Programming/Introduction.
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
Practice for Chapter 3: Assume that you are a freelance web designer and need to create a website to promote your freelance company.
JQuery Animation. If you look at example1.html, you will see that it is a basic web page with links to the jquery library, and a script.js file and some.
HTML. Hyper Text Markup Language Markup your text document The markup is the tag Hyper text means you can jump from place to place Programming language.
IN THIS LESSON WE WILL REVIEW THE STRUCTURE OF THE INTERNET AND HOW BROWSERS ASSEMBLE WEBSITES BASED ON INSTRUCTIONS THEY RECEIVE FROM SERVERS. Internet.
EXTERNAL STYLESHEETS AND MORE HTML STYLING HTML and CSS part 2.
Randomness Exploring Computer Science Lesson 4-10 – Part 2.
Making the website. Get your folders sorted first Create a new folder in “N” called “My hockey website” Create folders inside called “Documents”, “images”
Recap: If, elif, else If <True condition>:
Human Computer Interaction
ENEE150 Discussion 02 Section 0101 Adam Wang.
HTML Lesson 3.
In-Class Program: Sales System
Welcome to Experts! While you’re waiting, check your audio. EXPERTS.
Probability And Expected Value ————————————
In Class Programming BIS1523 – Lecture 11.
Video Player BIS1523 – Lecture 22.
Putting it all together
An Introduction to Animation
Probability And Expected Value ————————————
Following these steps, you can output your record to your wiki quickly
Making a website.
Building a website: Putting it all together
HTML & CSS 7 Languages in 7 Days.
The Strategic Game of Links
HTML.
How to add a photo gallery in html/css
© 2017, Mike Murach & Associates, Inc.
Presentation transcript:

Ajax Dice Game Part 1

We saw that we could use the jQuery load() function, to dynamically load a piece of an html document into another html document without refreshing the page. The next step is to load something less static than html into the page. You may remember the php dice game from a different class. Lets use it to test this functionality. If you download and unzip the ajaxdice folder and put it in the htdocs folder you will find a bunch of files. Included are the pictures of the dice and the dicegame.php file (among the other files). If you run the dicegame.php file through the local host, you will get two pairs of dice. One for player and one for house.

With each reload of the page, you will get a different set of dice and potentially a different outcome for the game. Lets review the PHP quickly. First we have our array of images, which match the image files of the dice. The first element in the array is empty, so we don't have to worry about element #0.

We generate four random numbers - one for each die. Then we add two together for the player total and two for the house total. Then we have PHP print a to the screen and inside it we use two of our random numbers to pull two images of dice from our array and print them to the screen. We do the same thing for the other two dice.

Finally, we determine which number was bigger and print out the correct winning statement. If we load the index.html page through the localhost, we get a link to roll the dice.

When you roll the dice, the dicegame.php file gets loaded dynamically into the page without reloading the page. Each click of the link reloads the php file dynamically. If you look at the script.js file, you will see the jQuery used to load the dicegame.php file. Its pretty straight forward. Also notice, if you look at the stylesheet, we can create styles for the divs that get loaded dynamically. That is where the red border is coming from.