Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Formularz konflikt chyba cudzysłowów
vingar
post 22.11.2010, 17:49:39
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 23.12.2009

Ostrzeżenie: (0%)
-----


Tutaj fragment kodu który napisalem
  1. <?php
  2.  
  3. function form(){
  4. echo '<form action="zapis.php" method="post">
  5.  
  6. <input type="text" name="email" style="width: 200px;" value="E-mail" onfocus="if (this.value == “E-mail") {this.value = "";}" onblur="if (this.value == "") {this.value = "E-mail";}"/><br />
  7.  
  8. <input type="text" name="email2" style="width: 200px;" value="Powtórz e-mail" onfocus="if (this.value == "Powtórz e-mail) {this.value = "";}" onblur="if (this.value == "") {this.value = "Powtórz e-mail";}"/><br />
  9.  
  10. <input type="password" name="pass" style="width: 200px;" value="Haslo" onfocus="if (this.value == "Haslo") {this.value = "";}" onblur="if (this.value == "") {this.value = "Haslo";}"/><br />
  11.  
  12. <input type="password" name="pass2" style="width: 200px;" value="Powtórz hasło" onfocus="if (this.value == "Powtórz hasło") {this.value = "";}" onblur="if (this.value == "") {this.value = "Powtórz hasło";}"/><br />
  13.  
  14. <input type="text" name="imie" style="width: 200px;" value="Imie" onfocus="if (this.value == "Imie") {this.value = "";}" onblur="if (this.value == "") {this.value = "Imie";}"/><br />
  15.  
  16. <input type="text" name="nazwisko" style="width: 200px;" value="Nazwisko" onfocus="if (this.value == "Nazwisko") {this.value = "";}" onblur="if (this.value == "") {this.value = "Nazwisko";}"/><br />
  17.  
  18. <input type="text" name="ulica" style="width: 200px;" value="Ulica" onfocus="if (this.value == "Ulica") {this.value = "";}" onblur="if (this.value == "") {this.value = "Ulica";}"/><br />
  19.  
  20. <input type="text" name="dom" style="width: 200px;" value="Numer domu" onfocus="if (this.value == "Numer domu") {this.value = "";}" onblur="if (this.value == "") {this.value = "Numer domu";}"/><br />
  21.  
  22. <input type="text" name="mieszk" style="width: 200px;" value="Numer mieszkania" onfocus="if (this.value == "Numer mieszkania) {this.value = "";}" onblur="if (this.value == "") {this.value = "Numer mieszkania";}"/><br />
  23.  
  24. <input type="text" name="kod" style="width: 50px;" value="Kod pocztowy" onfocus="if (this.value == "Kod pocztowy") {this.value = "";}" onblur="if (this.value == "") {this.value = "Kod pocztowy";}"/>
  25.  
  26. <input type="text" name="miasto" style="width: 150px;" value="Miasto" onfocus="if (this.value == "Miasto") {this.value = "";}" onblur="if (this.value == "") {this.value = "Miasto";}"/><br />
  27.  
  28. <input type="text" name="telkom" style="width: 200px;" value="Telefon" onfocus="if (this.value == "Telefon") {this.value = "";}" onblur="if (this.value == "") {this.value = "Telefon";}"/><br />
  29. <input type="submit" value="Rejestruj" />
  30. </form>';
  31. ?>

Nie działa mi w tym kodzie ani onblur ani onfocus jest to spowodowane z tego mi się wydaje cudzysłowami, mam podobny skrypt i tam ta druga część go jest w apostrofach(zaznaczyłem pogrubieniem)
  1. onblur="if (this.value == "") {this.value = "E-mail";}
nie problem to zmienić ale wtedy jest jakiś konflikt z apostrofem przy echo, przeglądarka wyskakuje z błędem składni i unexpected '
Bardzo proszę o pomoc jak to rozwiązać
Go to the top of the page
+Quote Post
outsider
post 22.11.2010, 17:55:43
Post #2





Grupa: Zarejestrowani
Postów: 267
Pomógł: 36
Dołączył: 8.08.2008

Ostrzeżenie: (0%)
-----


Kod
onblur="if (this.value == \'\') {this.value = \'E-mail\';}

powinno działać smile.gif

Ten post edytował *OuTSideR* 22.11.2010, 17:56:04
Go to the top of the page
+Quote Post
vingar
post 22.11.2010, 22:06:09
Post #3





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 23.12.2009

Ostrzeżenie: (0%)
-----


Działa bardzo dziękuje. Mam jeszcze jedno pytano jak usunąć to że po wciśnięciu komórki jej ramka się tak zaświeca.


Ten post edytował vingar 23.11.2010, 08:54:44
Go to the top of the page
+Quote Post
Majzok
post 22.11.2010, 22:48:22
Post #4





Grupa: Zarejestrowani
Postów: 20
Pomógł: 1
Dołączył: 25.11.2007
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Podświetlanie się komórki jest kwestią przeglądarki - raczej nic z tym nie zrobisz. Co drugiego pytania to nie do końca rozumiem...
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.05.2025 - 15:47