JavaScript - Random Message With No Repeats
im trying to display a random number, but each time a button is pressed that calls the test function, i don't want to random number to be repeated. i know i have to declare 2 variables and a while loop, but i'm stuck as to what to put in the second variable and in the while loop. any advice is appreciated
var random = Math.floor(Q * Math.random()); var random2 = ?? function test () { document.write(random); while (random == random2) { document.write(random); } } Similar TutorialsI want a certain amount of image spots to show a certain set of images (specifically 8) in a random order every time the page is refreshed. I do not want the images to be repeated, however. The solution I came up with was to create an array and generate a number one to eight and then compare that number to the numbers previously in the array, and if it matched one that was previously generated, to generate a new number and then compare it. This continues until i have an array of the numbers 1-8 in a random order. Code: var imgs=new Array(8); for(i in imgs) { function generate() { return Math.floor(1+Math.random()*8); } var rand=generate(); function compare(i) { for(var n=i-1; n>=0; n--) { if (n<0) { imgs[i]=rand; } else { if (rand==n) { rand=generate(); compare(i); } } } } } This does not strike me as the most efficient way to go about this. If someone has a better solution, that would help a great deal. I've looked for a solution to this issue, but it seems like a little different scenario than other situations. I made a system for generating friend requests on Facebook. I have a grid that is 6 x 3, for a total of 18 cells. Each cell has a picture in it, and the picture is linked to the Facebook friend request page. My problem is that since each cell is populated at random from the array, I'm getting lots of repeats. For example, some picutures are in 5 cells, and some are in none. I'm trying to figure out how to make it so that once a picture is used once in the grid, it does not get used again in the same grid. I still want every cell filled at random on each page load, I just want to prevent the repeating. Here's my current code: Code: <script type="text/javascript"> var vip_list=new Array( new Array('http://profile.ak.fbcdn.net/v225/1616/88/s1220771654_2158.jpg','http://www.facebook.com/addfriend.php?id=1220771654'), new Array('http://profile.ak.fbcdn.net/v223/1233/29/s904885342_9055.jpg','http://www.facebook.com/addfriend.php?id=904885342'), new Array('http://profile.ak.fbcdn.net/v229/1574/66/s1752031238_626.jpg','http://www.facebook.com/addfriend.php?id=1752031238'), new Array('http://profile.ak.fbcdn.net/v223/768/71/n661155042_7325.jpg','http://www.facebook.com/addfriend.php?id=661155042'), new Array('http://profile.ak.fbcdn.net/v226/732/26/n1827289885_2478.jpg','http://www.facebook.com/addfriend.php?id=1827289885'), new Array('http://profile.ak.fbcdn.net/v229/1631/70/s1425313768_1140.jpg','http://www.facebook.com/addfriend.php?id=1425313768'), new Array('http://static.ak.fbcdn.net/pics/s_silhouette.jpg','http://www.facebook.com/addfriend.php?id=1667023416'), new Array('http://profile.ak.fbcdn.net/v225/1146/29/s506485704_9532.jpg','http://www.facebook.com/addfriend.php?id=506485704'), new Array('http://profile.ak.fbcdn.net/profile6/270/32/s692160490_8745.jpg','http://www.facebook.com/addfriend.php?id=692160490'), new Array('http://profile.ak.fbcdn.net/v229/114/83/s1218176198_7375.jpg','http://www.facebook.com/addfriend.php?id=1218176198'), new Array('http://profile.ak.fbcdn.net/v226/946/4/s1470171885_4973.jpg','http://www.facebook.com/addfriend.php?id=1470171885'), new Array('http://static.ak.fbcdn.net/pics/s_silhouette.jpg','http://www.facebook.com/addfriend.php?id=1329505888'), new Array('http://static.ak.fbcdn.net/pics/s_silhouette.jpg','http://www.facebook.com/addfriend.php?id=1325496968'), new Array('http://profile.ak.fbcdn.net/v223/1546/92/s1536913202_2017.jpg','http://www.facebook.com/addfriend.php?id=1536913202'), new Array('http://static.ak.fbcdn.net/pics/s_silhouette.jpg','http://www.facebook.com/addfriend.php?id=1624715433'), new Array('http://profile.ak.fbcdn.net/v228/1282/58/s713998257_3682.jpg','http://www.facebook.com/addfriend.php?id=713998257') ); var chosen_vip=Math.floor(vip_list.length*Math.random()); var chosen_vip1=Math.floor(vip_list.length*Math.random()); var chosen_vip2=Math.floor(vip_list.length*Math.random()); var chosen_vip3=Math.floor(vip_list.length*Math.random()); var chosen_vip4=Math.floor(vip_list.length*Math.random()); var chosen_vip5=Math.floor(vip_list.length*Math.random()); var chosen_vip6=Math.floor(vip_list.length*Math.random()); var chosen_vip7=Math.floor(vip_list.length*Math.random()); var chosen_vip8=Math.floor(vip_list.length*Math.random()); var chosen_vip9=Math.floor(vip_list.length*Math.random()); var chosen_vip10=Math.floor(vip_list.length*Math.random()); var chosen_vip11=Math.floor(vip_list.length*Math.random()); var chosen_vip12=Math.floor(vip_list.length*Math.random()); var chosen_vip13=Math.floor(vip_list.length*Math.random()); var chosen_vip14=Math.floor(vip_list.length*Math.random()); var chosen_vip15=Math.floor(vip_list.length*Math.random()); var chosen_vip16=Math.floor(vip_list.length*Math.random()); var chosen_vip17=Math.floor(vip_list.length*Math.random()); document.write('<center>'); document.write('<a href="',vip_list[chosen_vip][1],'" target="_blank"><img src="',vip_list[chosen_vip][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip1][1],'" target="_blank"><img src="',vip_list[chosen_vip1][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip2][1],'" target="_blank"><img src="',vip_list[chosen_vip2][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip3][1],'" target="_blank"><img src="',vip_list[chosen_vip3][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip4][1],'" target="_blank"><img src="',vip_list[chosen_vip4][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip5][1],'" target="_blank"><img src="',vip_list[chosen_vip5][0],'" height="60" width="60"></a>'); document.write('<br>'); document.write('<a href="',vip_list[chosen_vip6][1],'" target="_blank"><img src="',vip_list[chosen_vip6][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip7][1],'" target="_blank"><img src="',vip_list[chosen_vip7][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip8][1],'" target="_blank"><img src="',vip_list[chosen_vip8][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip9][1],'" target="_blank"><img src="',vip_list[chosen_vip9][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip10][1],'" target="_blank"><img src="',vip_list[chosen_vip10][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip11][1],'" target="_blank"><img src="',vip_list[chosen_vip11][0],'" height="60" width="60"></a>'); document.write('<br>'); document.write('<a href="',vip_list[chosen_vip12][1],'" target="_blank"><img src="',vip_list[chosen_vip12][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip13][1],'" target="_blank"><img src="',vip_list[chosen_vip13][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip14][1],'" target="_blank"><img src="',vip_list[chosen_vip14][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip15][1],'" target="_blank"><img src="',vip_list[chosen_vip15][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip16][1],'" target="_blank"><img src="',vip_list[chosen_vip16][0],'" height="60" width="60"></a>'); document.write('<a href="',vip_list[chosen_vip17][1],'" target="_blank"><img src="',vip_list[chosen_vip17][0],'" height="60" width="60"></a>'); document.write('<br>'); </script> Any suggestions? Thank you! I was wondering if there was an easy way to configure a message box to resemble that of a login form. It would preferably have two text fields for username/password and OK and Cancel buttons as well. I currently have a normal login form on my website designed using PHP but it does not figure into what we need to do now. I'm not sure about going about this and I have tried looking for quite sometime for an example of this but cannot find one.
i have multiple customers in my company and i want to send an SMS to the mobile (cell phone) of the customer that he must pay the renewals fee's durng 2 weeks.. so i send to him an e-mail and at the same time i send for him an SMS message to his phone to ensure that he will read the message that he must pay the fee's. i dont know if there is a module that can make this idea or i must buy a product or register into a website to make this module... thnx alot Hello all, I'm trying to write a simple script in JS that will show a message for each day of the week. I have searched in your forums and other places but sadly I keep failing. Thank you for helping a newb. Code: <script type="JavaScript"> function showMessage() { var d = new Date(); var day = d.getDay(); // Note: Sunday=0, Monday=1, etc... switch( true ) } case ( day == 6 ) : { document.write("Today is saturday!") } case ( day == 5 ) : { document.write("Today is friday!") } case ( day == 4 ) : { document.write("Today is thursday!") } case ( day == 3 ) : { document.write("Today is wednesday!") } case ( day == 2 ) : { document.write("Today is tuesday!") } case ( day == 1 ) : { document.write("Today is monday!") } case ( day == 0 ) : { document.write("Today is sunday!") } } } </script> Hi all new guy on the block here, I've got a website, and I want to add a welcoming message which hovers on a certain part of the page which only loads for the visitor for the first time they login, and won't again(presumably cookies used). And says something like "adjust your settings here.." I don't want it to be an external popup but something that loads on the page in a certain area, defined by me (PX-pixle reference) I think i nutted something out in a bit of PHP, this is what i've got so far PHP Code: <?php if (firstLogin()){ genSpecial(***load jquerie or css etc***); } else{ genRegular(); } ?> can anyone help me figure out how to make this all work and load a box from jquerie or something similar? thanks David Hello, I was wanting a message to be displayed if it is the visitors first time to the site. It will be a toolbar displayed at the top of the website, with links to FAQ's. Any method of display this is fine. Thanks Hi, I want to pop up message incase of validation failure of form field. If I use document.write("name shold be between 2 to 15 char only") it redirects to new page and gives this message.......... if I use alert than incase or 2 or more validation fail it gives multiple or one by one alert boxes. I want to to displey my message near to field............... Code: function validateForm() { var x=document.forms["regform"]["email_id"].value; var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) { alert("Not a valid e-mail address"); return false; } } Can anyone help me with the following error message and correlating script please. I think it's just a simple omission. Any help appreciated. Thanks Microsoft VBScript compilation error '800a0400' Expected statement /shop$db.asp, line 3083 end sub ^ sub ShopWriteHeaderBox (msg) %> <div class="comment_title fontbold"><%=msg%></div> <div class="comment_text"> <div class="blog_review_container" > <% end sub sub ShopWriteFooterBox (yesbr) %> </div> </div> <% if lcase(trim(yesbr)) = "yes" then %> <br /> <% end if end sub okay. I am in the process of learning javascript and I've been looking at this code for the longest time ever. So far I got most of it done. but the problem is for example I leave all the required fields empty, it gives me the alert message of the first field and not the alert messages of all the others. What I want to know is how can you go through and check the whole form first before submitting and then when there is any error on any field, shows just one alert message containing all the error messages. code for the form Code: <form action="mailto:hummdedum@felloff.com" method="post" name="form" onSubmit="return isFormValid();"> * First Name: <input type="text" name="FName" id="FName" onblur="checkFName();"/><label id="labelFName"></label><br /> * Last Name: <input type="text" name="LName" id="LName"onblur="checkLName();"/><label id="labelLName"></label><br /> * Password: <input type="password" id="pw" name="Password" onblur="checkpw();" id="pw"/><label id="labelpw"></label><br /> *Re-type Password: <input type="password" name="2Password" id="pw2" onblur="checkpw2();" /><label id="labelpw2"></label><br /> I am a: <br /> <input type="radio" name="status" value="fresh" /> Freshman<br /> <input type="radio" name="status" value="soph" /> Sophomore<br /> <input type="radio" name="status" value="jr" /> Junior<br /> <input type="radio" name="status" value="sr" /> Senior<br /> I am taking classes in the: <br /> <input type="checkbox" name="semester" value="fall" /> fall time<br /> <input type="checkbox" name="semester" value="spring" /> Spring time <br /> My favorite element is: <select name="element" id="element"> <option value="">select one</option> <option value="fire">Fire</option> <option value="earth">Earth</option> <option value="water">Water</option> <option value="air">Air</option> </select><br /> *Birthday: <input type="text" id="BDay" name="Birthday" onblur="checkBDay();"/><label id="labelBDay"></label><br /> *E-Mail: <input type="text" id="email" name="Email" onblur="checkEmail();"/><label id="labelEmail"></label><br /> <input type="submit" value="Submit" /> <input type="reset" value="Clear" /> </form> code for the javascript Code: function isFormValid() {var userF = document.getElementById('FName').value; var userL = document.getElementById('LName').value; var userPW = document.getElementById('pw').value; var userPW2 = document.getElementById('pw2').value; var userBDay = document.getElementById('BDay').value; var userEmail = document.getElementById('email').value; var NameFormat = /^[A-Za-z]{2,12}$/; var PWFormat = /^[A-Za-z0-9{6,12}$]/; if (!NameFormat.test(userF)) { alert("First Name is required and should only have letters. 2-12 letters max"); return false; } if (!NameFormat.test(userL)) { alert("Last Name is required and should only have letters. 2-12 letters max"); return false; } if (!PWFormat.test(userPW)) { alert("Password is required and should only have letters and numbers. 6-12 letters max"); return false; } if (userPW != userPW2) { alert("Passwords do not match."); return false; } } function checkFName() { var userF = document.getElementById('FName').value; var elementF = document.getElementById('labelFName'); var NameFormat = /^[A-Za-z]{2,12}$/; if (!NameFormat.test(userF)) { elementF.innerHTML = "First Name is required and should only have letters. 2-12 letters max"; elementF.style.color = "red"; } else { elementF.innerHTML = ""; elementF.style.color = "green"; } } function checkLName() { var userL = document.getElementById('LName').value; var elementL = document.getElementById('labelLName'); var NameFormat = /^[A-Za-z]{2,12}$/; if (!NameFormat.test(userL)) { elementL.innerHTML = "Last Name is required and should only have letters. 2-12 letters max"; elementL.style.color = "red"; } else { elementL.innerHTML = ""; elementL.style.color = "green"; } } function checkpw() { var userPW = document.getElementById('pw').value; var elementPW = document.getElementById('labelpw'); var PWFormat = /^[A-z0-9]{6,12}$/; if (!PWFormat.test(userPW)) { elementPW.innerHTML = "Password is required and should only have letters and numbers. 6-12 letters max"; elementPW.style.color = "red"; } else { elementPW.innerHTML = "Valid Password"; elementPW.style.color = "green"; } } function checkpw2() { var userPW2 = document.getElementById('pw2').value; var userPW = document.getElementById('pw').value; var elementPW2 = document.getElementById('labelpw2'); if (userPW != userPW2) { elementPW2.innerHTML = "Passwords do not match."; elementPW2.style.color = "red"; } else { elementPW2.innerHTML = "Passwords Match"; elementPW2.style.color = "green"; } } I want to also validate birthday.. and I tried using regular expression with leap years but the expression is too hard for me to think of. so I am gonna try using split() but I dont noe... and for the clear button. since I blur functions, how would I just clear all the blur statements = like a restart of the form and then when the user enters the field the blur function still works? thanks -pumpkin I can't seem to shake this error message. Here is the code I am working with PHP Code: <tr> <td> <img onClick="showUser(1,\''.$time.'\');" src="'.$this->getPhoto($array[0][1]['uid'],'').'" > </td> <td> <img onClick="showUser(2,\''.$time.'\');" src="'.$this->getPhoto($array[0][2]['uid'],'').'" > </td> <td> <img onClick="showUser(3,\''.$time.'\');" src="'.$this->getPhoto($array[0][3]['uid'],'').'" > </td> <td> <img onClick="showUser(4,\''.$time.'\');" src="'.$this->getPhoto($array[0][4]['uid'],'').'" > </td> and the function PHP Code: '.$this->get_javascript_array($this->data,'data').' function showUser(arr, time) { var likes; var comments; switch(time) { case "Day": likes = data['day\'][0][arr][\'likes\']); comments = data[\'day\'][0][arr][\'comments\']); break; case "Week": likes = data[\'week\'][0][arr][\'likes\']); comments = data[\'week\'][0][arr][\'comments\']); break; case "Month": likes = data[\'month\'][0][arr][\'likes\']); comments = data[\'month\'][0][arr][\'comments\']); break; case "Year": likes = data[\'year\'][0][arr][\'likes\']); comments = data[\'year\'][0][arr][\'comments\']); break; } }; </script> '; I keep getting the following error and it's driving me nuts PHP Code: missing ; before statement [Break on this error] likes = data['day'][0][arr]['likes']);n hi guys, im not very good with javascript/jquery, i have the following code: Code: <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(window).ready(function() { $("#responsecontainer").load("includes/inc-mess-jail.php", function(response, status, xhr) { }); var refreshId = setInterval(function() { $("#responsecontainer").load('includes/inc-mess-jail.php?randval='+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> it basically updates the div tag: Code: <tr> <td colspan="2"> <div id="responsecontainer" align="center"></div> </td> </tr> i wanted to add an error message to it, that comes up underneath the <div id="responsecontainer" align="center"></div> that says "Error" with an id number next to it, then when your mouse goes over it a box comes out saying "there was a problem retrieving your information. the game will continue trying to resolve this" and then underneath where it says error i would like it to say the number of attempts it has tried to recollect the information. obviously i would only like this error message to come up, when it cannot refresh the information. Any help would be great, even pointing me in the right direction javascript2.js Code: function displayMessage(msg) { // Open a new window var msgWindow = window.open('', 'Message'); // Write message in the new Window msgWindow.document.write(msg); // Raise this window, in case it's not visible msgWindow.focus(); } //Enter total number of questions: var totalquestions=13 var correctchoices=new Array("a","a","b","c","b","c","a","a","b","c","a","b","b"); var correctanswers=new Array("memory locations","_ underscore","x=5+5;","20","Else","lose win","ticker = ticker + 1;","Ticker = ticker + 1;","300.000","Jonathon \b","var","var counter;","var mark = 50, 70"); function gradeit(){ var actualchoices=new Array() var msg1=new Array() var correctanswersno=0 var t=0 var displaycorrectanswers="" for (q=1;q<=totalquestions;q++){ var thequestion=eval("document.Questionform.q"+q) for (c=0;c<thequestion.length;c++){ if (thequestion[c].checked==true) actualchoices[q]=thequestion[c].value } if (actualchoices[q]==correctchoices[q]){ msg1[t]=q+")"+" Correct"; correctanswersno = correctanswersno + 1; t = t + 1; } else { msg1[t]=q+")"+" Incorrect: <br>Correct Answer: "+correctchoices[q]+") "+correctanswers[q]; t = t + 1; } } for (p=0;p<=12;p++){ displaycorrectanswers+="<br>"+msg1[p]; } var msg="Sco "+correctanswersno+"/"+totalquestions+" <br><br>Marks: "+displaycorrectanswers; displayMessage(msg); } Basically on my index page it has a button which when clicked makes use of gradeit(). Currently this then used displayMessage(msg) which opens a new window and displays the message. However, what I want it to do is to open another created html page e.g. answer.html and then for this page to display the message. How do i do this? Hee guys, I've got a little bit of a problem on my hand. Someone has asked me to help them on a FREE forum host. You have no access to PHP or SQL or anything like that. Just the templates, but even those are really messy! Now on the navagation bar there a PM section (obviously) but the wording they have used is very long and ugly. I was wondering if it would be possible to change the wording whilst still having it show the amount of PM's that you have. If you need anymore information just ask, but I really hope someone can help Hi, I'm trying to figure out how to make this work and I'm stumped. I wrote this code: <script type=text/javascript> function firstfunction(); { if(document.form1.inputnumbers.value="55"); { document.form1.outputstate.value="this is a number"; } else if { document.form1.inputnumbers.value="never"; } { document.form1.outputstate.value="this is a number"; } else { document.form1.outputstate.value=""; } </script> <form name="form1" method="post"> <input type="text" id="inputnumbers" name="inputnumbers";> <input type="button"; value="Enter"; onclick="firstfunction()"><br><br> <textarea id="outputstate"; name="outputstate"; cols=60; rows=10; style="border:1"; readonly;> I'm trying to doing something really simple but I can't seem to make it work. I'm trying have the textarea display a certain message depending on if the first input box says a certain word or number. So like in the code, if the user types "55" or "never" in the first box, then the second box should say a certain message. Then I used the else statement so that if "55" or "never" is not entered, then the second box says nothing. If you can spot my error or suggest a different way of going about writing the code, it would be very much appreciated. Thank you. Hi there, I am trying to add something from a textbox within a prompt message into a listbox. When I press the "Add" button, a prompt message will pop up. I will check if the textbox is empty. If it is empty and I press okay, it will show an alert message stating "Empty insert. Please enter something into the textbox." And if I press cancel, it will show alert message "You have pressed cancel." If it is not empty, and I press okay, it will insert the data into the listbox successfully. If I press cancel, it will show alert message "You have pressed cancel." Below are my codes. Javascript Code: function addOption() { var newItem = prompt("Enter New Item"); if (!newItem == "") { var answer = confirm ("Are you sure you want to add? ") if (answer)//if answer is true { var lstBx = document.getElementById("lstBxEmail"); // Now we need to create a new 'option' tag to add to MyListbox var newOption = document.createElement("option"); newOption.value = newItem; // The value that this option will have newOption.innerHTML = newItem; // The displayed text inside of the <option> tags // Finally, add the new option to the listbox lstBx.appendChild(newOption); //sort items in listbox in alpha order arrTexts = new Array(); for(i=0; i<lstBx.length; i++) { arrTexts[i] = lstBx.options[i].text; } arrTexts.sort(); for(i=0; i<lstBx.length; i++) { lstBx.options[i].text = arrTexts[i]; lstBx.options[i].value = arrTexts[i]; } } else { if(newItem) { alert("Key something to textbox please."); } else alert("Cancel choice."); } } } HTML Code: <center><input id="Submit18" type="submit" value="Add Address" onclick="addOption()"/> <div>Address:</div> <center> <select id="lstBxEmail" name="listBoxEmail" multiple="multiple" style="width: 580px;"> <option>Java</option> <option>PHP</option> <option>Perl</option> <option>Javascript</option> <option>C#</option> <option>Powershell</option> </select> </center> Hi there, I have this form that validates a few textboxes & a dropdownlist. And when it is not filled in, the border of the textboxes and dropdownlist would turn red, followed by an alert message notifying which field have not been filled in. Else, the border will revert back to black, and the form will be submitted successfully. There's a problem whereby when everything is filled in, the alert message still pops up. Any kind souls to help me? Thanks in advance. Javascript Code: function check(checkForm) { var fields = new Array("Name","Email Address", "Domain Name"); var index = new Array(),k=0; for(var i=0;i<fields.length;i++) { var isFilled = false; var c = document.getElementsByName(fields[i]); for(var j = 0; j < c.length; j++) if(!c[j].value == "") { isFilled = true; c[j].className = "defaultColor"; } else { c[j].className ="changeToRed"; } if(!isFilled) { index[k++] = fields[i]; } } if(k.length!=0) { joinComma = index.join(', '); alert('The field(s) corresponding to '+ joinComma + ' is/are not selected.'); return false; } } HTML Code: *Last Name: <input type="text" id="Text27" name="Last Name" /><br /> <br /> *Email Address: <input type="text" id="Text28" name="Email Address" /> @ <select id="Select5" name="Domain Name"> <option></option> <option>hotmail.com</option> <option>yahoo.com</option> </select> <input id="Submit5" type="submit" value="Submit" onclick="return check(checkForm)"/> hello there im unsure if this is the correct place to post this so if its not im sorry what im trying to do is make a javascript pop-up message in real time alerting members who are online at that time to a game submitted i help run a fifa10 online league site and we are venturing into the 2v2 part of the site. now when a player goes to the 2v2 page they are presented with a submit button to submit a 2v2 game to the system. then this already shows up on the pagebut what we are after is a little pop up box which after the game button is pressed to submit the game the pop-up shows to the whole site that a 2v2 game has been submitted for playing. we want this so you dont have to sit on the 2v2 page to wait for a submitted game. does anybody have any ideas on how we would go about this?? thanks for your time and i hope some1 can help - even if its just in the slightest Hey guys i am creating a Greasemonkey script that adds an ajax chat to a website. Greasemonkey is an addon for firefox that lets you modify the html code of websites before they are showed to the user. I am in the process of creating a wizz feature that will allow you to send a message to a member and where ever he is on the web his gona receive it. The way it works right now is there's a hidden iframe in every page load and when the player has a message it popups a small window It's working great but the popup is always instantly blocked because firefox has a popup bloker integrated and because it can popup on random websites they don't allow it and there for never gets the message ... Everything else i tryed was blocked by the fact that it opens in the iframe that is invisible. I even tryed doing it the old fashon way with an alert() but same thing you don't see it because it's in the hidden frame. And i tryed adding top.alert() but i get a javascript the "Access Denied" message. The "Access Denied" error in any browser usually means that a script in one window or frame is trying to access another window or frame whose document's domain is different from the document containing the script. I know DHTML AJAX popup would be the only way to give the user the message with out being blocked ... but how can i make it popup out of the iframe into the main frame with out being blocked in anyway ... I am out of ideas ... |