php - Javascript auto popup (without clicking a button) - Stack Overflow

I was just wondering if it is possible to display a javascript message (either popup or something nice)

I was just wondering if it is possible to display a javascript message (either popup or something nice) which is triggered by something which isn't a mouse click, so for example:

<?php if(a == b) {
    Then auto pop up something
}

I have had a look around and cant seem to find anything, also how do people make like stylistic popups like.. i guess maybe CSS but really fancy ones which cant be done with CSS any ideas?

Thanks a bunch :)

I was just wondering if it is possible to display a javascript message (either popup or something nice) which is triggered by something which isn't a mouse click, so for example:

<?php if(a == b) {
    Then auto pop up something
}

I have had a look around and cant seem to find anything, also how do people make like stylistic popups like.. i guess maybe CSS but really fancy ones which cant be done with CSS any ideas?

Thanks a bunch :)

Share Improve this question asked Feb 15, 2012 at 23:44 Ian TaylorIan Taylor 1791 gold badge5 silver badges18 bronze badges 2
  • 1 Really fancy pop up boxes can most certainly done with CSS. It's just really fancy CSS ;) – Casey Kinsey Commented Feb 15, 2012 at 23:49
  • The really fancy popup boxes are called 'modal dialogs'. Google it! – Calvin Commented Feb 15, 2012 at 23:52
Add a ment  | 

2 Answers 2

Reset to default 2

Just add a script block to open an alert or what ever you need to open

<?php if(a == b) { ?>
    <script>
          alert('hello');
          // or
          window.open("http://wwwstackoverflow.");
          // or any type of script you want to run

    </script>
<?php } ?>

For anyone ing here these days: window.open() called like that will be blocked by any modern browser.

If you're okay with including a third-party script, you can do this instead:

<?php if(a == b) { ?>
  <script>
    Popup("<div>Hello</div>").show('up')
  </script>
<?php } ?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744803820a4594651.html

相关推荐

  • php - Javascript auto popup (without clicking a button) - Stack Overflow

    I was just wondering if it is possible to display a javascript message (either popup or something nice)

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信