• No results found

1- Introduc+on to client- side Applica+ons Course: Developing web- based applica+ons

N/A
N/A
Protected

Academic year: 2021

Share "1- Introduc+on to client- side Applica+ons Course: Developing web- based applica+ons"

Copied!
23
0
0

Loading.... (view fulltext now)

Full text

(1)

1-­‐Introduc+on  to  

client-­‐side  Applica+ons  

(2)

Introduc*on  

(3)

Advantages  of  web-­‐based  applica+ons  

• 

Web-­‐based  applica*ons  have  many  advantages  over  

tradi*onal  applica*ons:  

– 

Compa*bility  

• 

Web-­‐based  applica*ons  run  on  the  user's  browser  

• 

HTML  language  ensures  compa*bility  across  plaIorms  

– 

Accessibility  

• 

Remote  access  is  a  design  prerequisite  

• 

Mobile  devices  widely  supported  

• 

There  are  many  browser  solu*ons  for  people  with  disabili*es:  

(4)

4  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

HTML  was  designed  for:  

• 

Maximizing  browser  compa*bility  

• 

Very  efficient  in  the  server-­‐side  (possibility  to  support  many  

concurrent  connec*ons)  

• 

Crea*ng  stunning  content  with  dynamic  features,  but  without  

compromising  the  previous  two  points.  

HTML  fails  on  the  last  point    

(5)

Some  programming  language  is  required  to  create  small  

applica*ons  embedded  in  the  web  pages.  

Examples:  

• 

Shopping  chart  

• 

Counter  of  number  of  visits  

• 

Webmail  

• 

Login  window    

(6)

Client-­‐side  programming  

(7)

Client-­‐side  

• 

The  Browser  downloads  the  code  along  with  standard  HTML  

• 

Then  the  soZware  runs  in  the  browser  

JavaScript

(8)

8  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

JavaScript  example  

• 

Syntax  similar  to  Java  (or  similar  to  C)  

• 

Integrated  with  standard  HTML  forms  

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

<html>

<head>

<title>JavaScript Example</title>

<script language="JavaScript">

<!-- Hide code if JavaScript is not supported

...JavaScript...

//End of hidden code -->

</script>

</head>

<body>

...HTML...

</body>

</html>

(9)

JavaScript  u+li+es  

• 

Using  JavaScript  it  is  possible  to  implement:  

– 

Form  valida*on  programs  

– 

Basic  computa*on  algorithms  

– 

Event  handlers  (ex.  mouse  hovering)  

– 

Calendars  

(10)

10  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

VBScript  example  

• 

Similar  to  JavaScript,  but  smaller  support  

• 

Visual  Basic  Syntax  

<HTML>

<HEAD><TITLE>Prueba de VBScript</TITLE>

<SCRIPT LANGUAGE="VBScript">

<!--

Sub Button1_OnClick

MsgBox "Hola Mundo"

End Sub

-->

</SCRIPT>

</HEAD>

<BODY>

<FORM><INPUT NAME="Button1" TYPE="BUTTON" VALUE="Pulsame"></

FORM>

</BODY>

</HTML>

(11)

Java  Applets  example  

• 

An  applet  is  a  Java  program  designed  to  run  inside  the  

browser  

• 

The  applet  is  downloaded  along  with  a  web  page  and  runs  

within  a  Java  Virtual  Machine  to  ensure  security  

– 

Applet  code:  

import  java.awt.*;  

import  java.applet.*;  

public  class  SimpleApplet  extends  Applet  {  

 public  void  paint  (Graphics  g){  

   

 g.drawString(“Hola  mundo”,20,20);  

 }

 

(12)

12  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

Java  Applets  example  2  

• 

Very  extended  support  (mul*plaIorm  as  Java)  

• 

Good  in  security  

• 

Procedure:  

– 

The  browser  downloads  a  web  page  from  the  server  

– 

The  browser  find  the  <applet>  tag  and  requests  the  applet  code  

– 

The  applet  code  is  run  in  a  JVM  (Java  Virtual  Machine)  

(13)

Ac+ve  X  example  

• 

Similar  to  Java  Applets  

• 

Inserted  in  web  pages  with  the  tag  <OBJECT>  

• 

Important  compa*bility  problems  

(14)

14  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

Adobe  Flash  

• 

Useful  for  anima*ons,  but  also  for  developing  applica*ons.  

• 

The  latest  versions  include  database  modules  

• 

Flash  may  interact  with  other  technologies  

(15)
(16)

JavaScript  easy  program  

(17)

JavaScript  fundamentals  

1. 

JavaScript  code  is  wriken  in  the  <head>    sec*on  of  the  HTML  

page  

2. 

JavaScript  func*ons  respond  to  objects  events.  Examples:  

– 

OnChange  

– 

OnSubmit  

3. 

JavaScript  func*ons  are  able  to  modify  any  object  property.  

Examples:  

– 

Text  color  

(18)

18  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

Dynamic  Styles  

• 

A  web  site  can  behave  as  an  applica*on  if  CSS  styles  are  

linked  to  forms  and  JavaScript  func*ons.  

Changes the style

(19)

Dynamic  Styles  

• 

div  object  with  style  type  “cuadro”  named  “id_cuadro1”  

<DIV class="cuadro" id="

id_cuadro1

">

<p>Párrafoprinero…</P>

<p>Segundo párrafo…</p>

</DIV>

(20)

20  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

Dynamic  Styles  

• 

<select>  object  to  call  a  JavaScript  for  events  type  

“OnChange”  

http://www.w3schools.com/tags/tag_textarea.asp

<SELECT NAME="colores"

OnChange="CambiarColor(this.value,'id_cuadro1');"

>

<OPTION VALUE="">--Elegir color--</OPTION>

<OPTION VALUE="r">Rojo</OPTION>

<OPTION VALUE="g">Verde</OPTION>

<OPTION VALUE="b">Azul</OPTION>

</SELECT>

(21)

Dynamic  Styles  

(22)

22  

Departamento  de  Sistemas  Informá+cos  

Escuela  Técnica  Superior  de  Ingeniería  ICAI   Developing  web-­‐based  applica+ons  2011  

Dynamic  Styles  

(23)

References

Related documents

For example, if the user is naive, we will restrict her possibilities to change model variables by generating fewer buttons in the user interface, perhaps we will include

Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.?. Thermometer:

A new distributed architecture was developed to alleviate load on a single host in the third version. Thus avoiding the impact of an increase of courses

A new distributed architecture was developed to alleviate load on a single host in the third version. Thus avoiding the impact of an increase of courses

The second student survey was given to each section at the end of the course and considered student’s reactions to both the wind power project and the course as a whole. Table 4 shows

Vidisco’s portable X-ray systems offer various inspec on tools and highest quality images on site, which facilitate taking informed. Full

With the addition of live labs to QuickCert's already industry leading training method, students have the ability to practice with the equipment they will be using before ever

To check if an entry violates any validation constraints, the client library delegates evaluation of a rules script to a preprocessing server: an asynchronous server