de la fenêtre.emplacement.indexOf pas de travail en Javascript

Ci-dessous est ce que j'ai.

var myString = "http://localhost:8888/www.smart-kw.com/";
alert(myString.indexOf("localhost"));

Cette me donner l'alerte... cependant si je change var myString = "http://localhost:8888/www.smart-kw.com/"; à var myString = window.location;, il ne fonctionne pas (je ne reçois pas d'alerte).

var myString = window.location;
alert(myString.indexOf("localhost"));
  • Bon, je vais prendre soin de cela.
InformationsquelleAutor Fahim Parkar | 2012-12-02