关于Javascript PopUp Windows的问题 [英] Question on Javascript PopUp Windows

查看:110
本文介绍了关于Javascript PopUp Windows的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java脚本的新手...在我的html页面中,我想通过单击JavaScript中的按钮来显示一个弹出窗口...并通过单击该弹出框来显示另一个弹出窗口,如下所示应该显示10个弹出框...


在第一个弹出框2中将显示,在第二个弹出框4中将显示,在第三个弹出框6中将显示...就像在弹出框上显示2乘以20一样....谁能帮上忙....


预先谢谢我们.

I am a new learner to java script...in my html page i would like to display a popup window by clicking on button through JavaScript...and by clicking on that popup box another popup window will be displayed like that 10 popup boxes should be displayed...


In first popup box 2 will be displyed and on second popup box 4 will be displyed and on third popup box 6 will be displayed...like that 2 multiplications up to 20 will be displayed on poup boxes....That is my requirement can any one help for this....


Thank''s In advance

推荐答案

好吧,这是一个丑陋的要求,因此要实现它也需要很丑陋的代码,但是它可以起作用:

http://jsfiddle.net/ALgnz/ [ ^ ]

基本的解决方案是使用jQuery(您可以直接使用javascript,但jQuery既快速又简单).我做了一个循环,使用两个的倍数显示了从2到20的值,如下所示:

Well, this is an ugly requirement and thus ugly code to fulfill it, but it works:

http://jsfiddle.net/ALgnz/[^]

The basic solution is to use jQuery (you could have used javascript directly but jQuery is quick and easy). I did a loop that shows the value from 2 to 20 using multiples of two like so:


(document).ready(function(){
(document).ready(function(){


(" ).click(function(事件){ for (i = 2 ; i< 22; i + = 2 ) { 警报(i); } }); });
("#myButton").click(function(event){ for(i=2;i<22;i+=2) { alert(i); } }); });



然后,当您单击按钮时,它将为每个值打开一个警报.由于这是一个循环,因此您可以使用传入的值来弄乱这些值,以便根据需要显示任意范围内的任意倍数.



Then when you click on the button, it opens an alert for each value. Since it is a loop, you could mess with the values using passed in values so that you could show any multiple with any range if you wanted.


这篇关于关于Javascript PopUp Windows的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆