Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Comments
Sergey Alexandrovich Kryukov 6-Jun-12 12:59pm    
What sense 10 pop-ups may make if even one is too much? Just to drive your users crazy? Or just with experimental/learning purposes? What's the problem? What have you done so far?
--SA
Divyay208 6-Jun-12 13:08pm    
That is My requirement Given By my friend...
Sandeep Mewara 6-Jun-12 15:12pm    
Ok then ask your friend why such requirement!
Sandeep Mewara 6-Jun-12 15:12pm    
BTW, what have you tried so far? Where are you stuck?

1 solution

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:

C#
$(document).ready(function(){
    $("#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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900