BlueGEEK Journal

Accueil > Manip’s > Javascript > Comment ouvrir une Page WEB en cliquant sur un bouton ?

Javascript

Comment ouvrir une Page WEB en cliquant sur un bouton ?

OnClick

samedi 4 mars 2006, par bluegyn_spip

<input type="button" value="Ouvrir"      onClick="window.location.href='mapage.html'">

BALISE

INPUT TYPE="BUTTON"

EVENEMENT

onClick

Argument Javascript

window.location.href

CODE COMPLET

- onClick=""

- +

- window.location.href=’mapage.html’

- =

onClick="window.location.href=’mapage.html’"


- Click avec un K

- Signe égal

- Double Guillemets entourent le code Javascript

- Simple Quote entourent le nom de la page

NB :

- Dans une ligne PHP => Il faut échapper les Quotes de cette façon : => \’mapage.html\’

echo '

<input type="button" value="Ouvrir" onClick="window.location.href=\'mapage.html\'">';