Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [inne] Google Chrome Wtyczka
aras785
post
Post #1





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

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


Witam. Mam takie pliki:

manifest.json
Kod
{
    "name": "Test",
    "description": "test",
    "browser_action": {
        "default_icon": {
            "38": "icon.png"
            },
        "default_title": "Test",
        "default_popup": "form.html"
    },
    "content_scripts": [
    {
      "matches": ["http://www.strona.pl/*"],
      "js": ["form.js"],
      "run_at": "document_end"
    }
  ],
    "manifest_version": 2,
    "version": "0.1"
}


form.html

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.  
  5. <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
  6. <link href='form.css' rel='stylesheet' type='text/css'>
  7.  
  8. <meta name="viewport" content="width=device-width" />
  9. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  10.  
  11. <title>Test</title>
  12.  
  13. <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  14.  
  15. </head>
  16.  
  17.  
  18. <body bgcolor="#FFF">
  19. <table class="body-wrap">
  20. <tr>
  21. <td class="container">
  22. <div class="content">
  23. <div id="pattern" class="pattern">
  24. <div id="test">Test</div>
  25. <form class="f">
  26. <input type="text" name="cos" placeholder="Wpisz cos..." />
  27. <input type="submit" class="btn search-submit" value="Dodaj">
  28. </form>
  29. </div>
  30. </div>
  31. </td>
  32. </tr>
  33. </table>
  34. </body>
  35. </html>


form.js
Kod
alert(32);


Chce aby po wpisaniu w polu "cos" (form.html) i kliknięciu przycisku "Dodaj" skrypt na stronie odpalił np. alert(cos). Proszę o próbkę kodu prostego, a nie odsyłacz do googli bo już tam byłem i nie zrozumiałem. Z góry dziękuje i pozdrawiam smile.gif



Ten post edytował aras785 10.09.2013, 20:37:17
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
ber32
post
Post #2





Grupa: Zarejestrowani
Postów: 332
Pomógł: 22
Dołączył: 6.07.2010

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


Witam.
  1. <input type="submit" onclick="return alert('cos')" class="btn search-submit" value="Dodaj">

Cytat
Proszę o próbkę kodu prostego, a nie odsyłacz do googli bo już tam byłem i nie zrozumiałem.

oneeyedsmiley02.png


--------------------
Go to the top of the page
+Quote Post
aras785
post
Post #3





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

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


Aha. Jakby to było takie proste... Oczywiście nie działa smile.gif Proszę o kolejne pomysły.
Go to the top of the page
+Quote Post
ber32
post
Post #4





Grupa: Zarejestrowani
Postów: 332
Pomógł: 22
Dołączył: 6.07.2010

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


Dlaczego nie działa


--------------------
Go to the top of the page
+Quote Post
aras785
post
Post #5





Grupa: Zarejestrowani
Postów: 859
Pomógł: 177
Dołączył: 29.10.2009

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


Ponieważ jest to pole wtyczki, a nie strony smile.gif
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 Aktualny czas: 22.08.2025 - 06:47