Java script problème de débutant.

Fermé
patrice - 17 sept. 2011 à 06:14
 patrice - 17 sept. 2011 à 12:24
Bonjour,

J'essaie d'apprendre le java script et pour tester mes différentes instructions, j'ai mis wamserver (ma Base de données) en local et j'utilise wordpress (site) en local.
A partir de mes pages du site en wordpress, j'appelle un fichier en .js. Ex(hello.js). dans lequel j'ai mis:
alert("Bonjour");
et ça fonctionne.

Cependant quand je modifie le fichier hello.js par
alert("Bonsoir");
j'ai toujours Bonjour qui apparaît.

Il faut que j'éteigne mon ordinateur pour qu'il veuille bien afficher Bonsoir.

Je pense qu'une variable, un cookie ou autre reste validé.
Si quelqu'un pourrait m'indiquer la manière de réinitialiser mon fichier .js

Merci

A voir également:

1 réponse

KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
17 sept. 2011 à 06:17
Essaye juste de rafraîchir ta page internet après chaque modification.
0
Bonjour KX

merci pour ta réponse rapide.

Comment rafraichir ma page ? j'ai fermé complétement IE ou taper sur F5, sans succès.

Patrice
0
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
17 sept. 2011 à 06:29
Je ne connais pas IE, il y a peut-être un cache derrière qu'il faudrait réinitialiser.
Essayes avec un autre navigateur (Chrome, Firefox...) pour voir.
0
Je viens d'essayer avec deux navigateurs:

Mozilla ne voit pas mon fichier java script et ne présente pas de boîte alert.

Google chrome : il a bien détecté le fichier Js modifié, mais quand je le modifie, il réagit de la même manière que IE. Il me présente toujours l'ancienne instruction.
Il semble qu'une fois qu'il a lu le fichier Js, il le relit pas et se contente de restituer ce qu'il a mémorisé.
0
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
17 sept. 2011 à 06:54
Il y a donc bien un petit problème ^^
Est-ce que tu peu donner tes codes html et js pour voir où ça coince ;-)
0
Je te donne les codes, petite précision avec wordpress on utilise un plugin pour écrire du javascript.

Fichier Javascript "hello.js" contenant:
alert("bonjour");

fichier HTML:




<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" dir="ltr" lang="fr-FR">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" dir="ltr" lang="fr-FR">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" dir="ltr" lang="fr-FR">
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html dir="ltr" lang="fr-FR">
<!--<![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Kisa | agi67</title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="http://localhost/wordpress/wp-content/themes/twentyeleven/style.css" />
<link rel="pingback" href="http://localhost/wordpress/xmlrpc.php" />
<!--[if lt IE 9]>
<script src="http://localhost/wordpress/wp-content/themes/twentyeleven/js/html5.js" type="text/javascript"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="agi67 » Flux" href="http://localhost/wordpress/?feed=rss2" />
<link rel="alternate" type="application/rss+xml" title="agi67 » Flux des commentaires" href="http://localhost/wordpress/?feed=comments-rss2" />
<link rel='stylesheet' id='admin-bar-css' href='http://localhost/wordpress/wp-includes/css/admin-bar.css?ver=20110622' type='text/css' media='all' />
<script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/l10n.js?ver=20101110'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/comment-reply.js?ver=20090102'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/wordpress/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wordpress/wp-includes/wlwmanifest.xml" />
<link rel='index' title='agi67' href='http://localhost/wordpress' />
<meta name="generator" content="WordPress 3.2.1" />
<link rel='canonical' href='http://localhost/wordpress/?page_id=2' />
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<style type="text/css" media="screen">
html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }
</style>
</head>

<body class="page page-id-2 page-template-default logged-in admin-bar single-author singular two-column right-sidebar">
<div id="page" class="hfeed">
<header id="branding" role="banner">
<hgroup>
<h1 id="site-title"><span><a href="http://localhost/wordpress/" title="agi67" rel="home">agi67</a></span></h1>
<h2 id="site-description">Un site utilisant WordPress</h2>
</hgroup>

<a href="http://localhost/wordpress/">
<img src="http://localhost/wordpress/wp-content/themes/twentyeleven/images/headers/trolley.jpg" width="1000" height="288" alt="" />
</a>

<form method="get" id="searchform" action="http://localhost/wordpress/">
<label for="s" class="assistive-text">Recherche</label>
<input type="text" class="field" name="s" id="s" placeholder="Recherche" />
<input type="submit" class="submit" name="submit" id="searchsubmit" value="Recherche" />
</form>

<nav id="access" role="navigation">
<h3 class="assistive-text">Menu principal</h3>
<div class="skip-link"><a class="assistive-text" href="#content" title="Aller au contenu principal">Aller au contenu principal</a></div>
<div class="skip-link"><a class="assistive-text" href="#secondary" title="Aller au contenu secondaire">Aller au contenu secondaire</a></div>
<div class="menu"><ul><li ><a href="http://localhost/wordpress/" title="Accueil">Accueil</a></li><li class="page_item page-item-2 current_page_item"><a href="http://localhost/wordpress/?page_id=2" title="Kisa">Kisa</a></li></ul></div>
</nav><!-- #access -->
</header><!-- #branding -->


<div id="main">
<div id="primary">
<div id="content" role="main">



<article id="post-2" class="post-2 page type-page status-publish hentry">
<header class="entry-header">
<h1 class="entry-title">Kisa</h1>
</header><!-- .entry-header -->

<div class="entry-content">
<script type="text/javascript" src="wp-content\plugins\js\hello.js">
</script> </div><!-- .entry-content -->
<footer class="entry-meta">
<span class="edit-link"><a class="post-edit-link" href="http://localhost/wordpress/wp-admin/post.php?post=2&action=edit" title="Modifier la page">Modifier</a></span> </footer><!-- .entry-meta -->
</article><!-- #post-2 -->

<div id="comments">




</div><!-- #comments -->

</div><!-- #content -->
</div><!-- #primary -->


</div><!-- #main -->

<footer id="colophon" role="contentinfo">



<div id="site-generator">
<a href="http://wordpress.org/" title="Plate-forme de publication personnelle à la pointe de la sémantique" rel="generator">Fièrement propulsé par WordPress</a>
</div>
</footer><!-- #colophon -->
</div><!-- #page -->

<script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/admin-bar.js?ver=20110131'></script>
<div id="wpadminbar">
<div class="quicklinks">
<ul>

<li id="wp-admin-bar-my-account-with-avatar" class="menupop">
<a href="http://localhost/wordpress/wp-admin/profile.php"><span><img alt='' src='http://0.gravatar.com/avatar/e66e649de718da0553bb34965420f567?s=16&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D16&r=G' class='avatar avatar-16 photo' height='16' width='16' />admin</span></a>

<ul>

<li id="wp-admin-bar-edit-profile" class="">
<a href="http://localhost/wordpress/wp-admin/profile.php">Modifier mon profil</a>


</li>
<li id="wp-admin-bar-logout" class="">
<a href="http://localhost/wordpress/wp-login.php?action=logout&_wpnonce=2c06bf77fb">Se déconnecter</a>


</li> </ul>

</li>
<li id="wp-admin-bar-dashboard" class="">
<a href="http://localhost/wordpress/wp-admin/">Tableau de bord</a>


</li>
<li id="wp-admin-bar-edit" class="">
<a href="http://localhost/wordpress/wp-admin/post.php?post=2&action=edit">Modifier la page</a>


</li>
<li id="wp-admin-bar-new-content" class="menupop">
<a href="http://localhost/wordpress/wp-admin/post-new.php?post_type=post"><span>Ajouter</span></a>

<ul>

<li id="wp-admin-bar-new-post" class="">
<a href="http://localhost/wordpress/wp-admin/post-new.php?post_type=post">Article</a>


</li>
<li id="wp-admin-bar-new-page" class="">
<a href="http://localhost/wordpress/wp-admin/post-new.php?post_type=page">Page</a>


</li>
<li id="wp-admin-bar-new-media" class="">
<a href="http://localhost/wordpress/wp-admin/media-new.php">Fichier multimédia</a>


</li>
<li id="wp-admin-bar-new-link" class="">
<a href="http://localhost/wordpress/wp-admin/link-add.php">Lien</a>


</li>
<li id="wp-admin-bar-new-user" class="">
<a href="http://localhost/wordpress/wp-admin/user-new.php">Utilisateur</a>


</li>
<li id="wp-admin-bar-new-theme" class="">
<a href="http://localhost/wordpress/wp-admin/theme-install.php">Thème</a>


</li>
<li id="wp-admin-bar-new-plugin" class="">
<a href="http://localhost/wordpress/wp-admin/plugin-install.php">Extension</a>


</li> </ul>

</li>
<li id="wp-admin-bar-comments" class="">
<a href="http://localhost/wordpress/wp-admin/edit-comments.php">Commentaires </a>


</li>
<li id="wp-admin-bar-appearance" class="menupop">
<a href="http://localhost/wordpress/wp-admin/themes.php"><span>Apparence</span></a>

<ul>

<li id="wp-admin-bar-themes" class="">
<a href="http://localhost/wordpress/wp-admin/themes.php">Thèmes</a>


</li>
<li id="wp-admin-bar-widgets" class="">
<a href="http://localhost/wordpress/wp-admin/widgets.php">Widgets</a>


</li>
<li id="wp-admin-bar-menus" class="">
<a href="http://localhost/wordpress/wp-admin/nav-menus.php">Menus</a>


</li>
<li id="wp-admin-bar-background" class="">
<a href="http://localhost/wordpress/wp-admin/themes.php?page=custom-background">Arrière-plan</a>


</li>
<li id="wp-admin-bar-header" class="">
<a href="http://localhost/wordpress/wp-admin/themes.php?page=custom-header">En-tête</a>


</li> </ul>

</li> </ul>
</div>

<div id="adminbarsearch-wrap">
<form action="http://localhost/wordpress" method="get" id="adminbarsearch">
<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />
<input type="submit" class="adminbar-button" value="Recherche"/>
</form>
</div>
</div>


</body>
</html>
0