Javascript1.2 - background
Marc
-
mmilian -
mmilian -
Bonjour et merci de votre attention.
J'ai un problème de fond :)
Je souhaite:
- tester la résolution d'écran
- faire afficher l'image de fond en fonction de la résolution
Pour ce faire voici le code que j'utilise mais il ne marche pas!
Si vous comprenez mon erreur ou si vous avez une solution de contournement astucieuse je suis tout à votre écoute...
Marc<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE="JavaScript1.2">
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" backgroung="javascript:(screen.width==800)?document.write("fond_acc.jpg"):document.write("fond_acc_1024.jpg")" text="#000000">
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- debut du script
if (screen.width==800)
alert("vous êtes en 800x600");
else if (screen.width >=1024)
alert("vous êtes en 1024x768 ou plus");
// Fin du script -->
</body>
</html>
J'ai un problème de fond :)
Je souhaite:
- tester la résolution d'écran
- faire afficher l'image de fond en fonction de la résolution
Pour ce faire voici le code que j'utilise mais il ne marche pas!
Si vous comprenez mon erreur ou si vous avez une solution de contournement astucieuse je suis tout à votre écoute...
Marc<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE="JavaScript1.2">
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" backgroung="javascript:(screen.width==800)?document.write("fond_acc.jpg"):document.write("fond_acc_1024.jpg")" text="#000000">
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- debut du script
if (screen.width==800)
alert("vous êtes en 800x600");
else if (screen.width >=1024)
alert("vous êtes en 1024x768 ou plus");
// Fin du script -->
</body>
</html>
A voir également:
- Javascript1.2 - background
- Windows 7 logon background changer - Télécharger - Thèmes & Fonds d'écran
- John's background switcher - Télécharger - Suite bureautique
- Starter background changer - Télécharger - Thèmes & Fonds d'écran
- Background color css ✓ - Forum CSS
- Realtek audio background process class c'est quoi ✓ - Forum Pilotes (drivers)
1 réponse
Voilà ta réponse.
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- debut du script
function Bckgrnd()
{
if (screen.width==800)
{
alert('vous êtes en 800x600');
document.body.background='2.jpg';
}
else if (screen.width >=1024)
{
alert('vous êtes en 1024x768 ou plus');
document.body.background='1.jpg';
}
}
// Fin du script -->
</SCRIPT>
</head>
<body onLoad="Bckgrnd()" text="#000000">
<H1>Hello</H1>
</body>
</html>
Bon courage !
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- debut du script
function Bckgrnd()
{
if (screen.width==800)
{
alert('vous êtes en 800x600');
document.body.background='2.jpg';
}
else if (screen.width >=1024)
{
alert('vous êtes en 1024x768 ou plus');
document.body.background='1.jpg';
}
}
// Fin du script -->
</SCRIPT>
</head>
<body onLoad="Bckgrnd()" text="#000000">
<H1>Hello</H1>
</body>
</html>
Bon courage !
Où puis-je trouver une liste exhaustive des propriétés et méthodes des objets document, window, etc...
@+
Marc