Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [AJAX]Jak przerobić funkcję zamiast click na load
cent4
post 30.01.2012, 13:32:33
Post #1





Grupa: Zarejestrowani
Postów: 415
Pomógł: 0
Dołączył: 24.12.2008

Ostrzeżenie: (10%)
X----


Jest skrypt: wyświetlający alert po przyciśnięciu przycisku:
http://thefinishedbox.com/files/freebies/alertbox/index.html
Chodzi mi o to, że skrypt z pytaniem ładuje się po kliknięciu, a chciałbym, żeby ładował się automatycznie - żeby ominąć przyciskanie przycisku.
Jak to zrobić?

index.html
  1. $(function() {
  2. $('#clickMe').alertBox({
  3. href: 'success.php'
  4. // You must add a
  5. // href page (success)
  6. });
  7. });
  8. </script>
  9.  
  10. </head>
  11. <div id="container">
  12. <div id="main" role="main">
  13. <a href="#" id="clickMe">Click Me</a>
  14.  
  15. </div>
  16.  
  17. </div>
  18.  
  19. </body>


alert.html:
  1. <div id="alert">
  2. <p>Are you sure you want to continue?</p>
  3. <a href="#" class="alertButton" id="yes"><span>Tak</span></a>
  4. <a href="#" class="alertButton" id="no"><span>Nie</span></a>
  5. </div>


alert.js:
  1. (function($){
  2.  
  3. $.fn.extend({
  4.  
  5. alertBox: function(settings) {
  6.  
  7. var defaults = {
  8. href: null
  9. };
  10.  
  11. var settings = $.extend(defaults, settings);
  12.  
  13. return this.each(function() {
  14.  
  15. var s = settings;
  16. var load = 'alert.php';
  17.  
  18. $(this).click(function(e) {
  19. .
  20. .
  21. .
Go to the top of the page
+Quote Post

Posty w temacie


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: 14.08.2025 - 11:04