JavaScript - Alert Images
Hi!
I've seen several sites that use what looks like the alert function (I know it isn't), where the site gets darkened and a popup box (similar to that of the alert one) comes up and displays an image (and only an image) ... how is this done? Regards Matthew Similar TutorialsI have an user table like this:- guid | username | password | firstname | lastname | location | emailad dress | userrole -----------------------------------+----------+----------------------------------+-----------+-----------+----------+-------- ------+--------------- 8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live .com | administrator 18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c om | administrator 2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | | | administrator (3 rows) now my postgre query for delete the row .... $query = "delete from users where username!= 'admin' and guid='".$guid."'"; $result = pg_query($conn, $query); ?> <script type="text/javascript"> alert("Cannot delete this .\n It is system generated(s)."); </script> <?php (1)when I delete the user name one by one then delete occurs in my page userlist.php, I donot want to delete admin so i use username!= 'admin' in where condition as shown above. (2)now when I del any username(3 rows) from user table then alert occurs & it delete from userlist.php after that my page userlist.php is blank. Finaly when i refresh the page then my admin username seen.. when i use return true; function then only alert generate .. delete doesnot occurs ... Actauly i want:- (1)if user is not admin then it delete from userlist.php ... nd also i m continue on this page ... like when james and saty want to delte their acount ..as given in table. (2)if user is admin then alert generate nd i m continue on this page. i m tired now plz help me .... so can anyone put the best condition in my coding. I am validating the value in a text area onBlur. If the value is not good the alert box comes up twice. Is there a way to correct this? Code: <html> <head> <meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> <title>Untitled</title> <script type="text/javascript"> function verify_score(val1) { var temp = document.getElementById(val1) if(temp.value == "AF"|| temp.value == "HF" || (temp.value >=0 && temp.value <=17)) {return} else{ alert("Value entered is not OK. Accetable values a 0 to 17, AF or HF") temp.focus() temp.select() } } </script> </head> <body> <div id="PageDiv" style="position:relative; min-height:100%; margin:auto; width:200px"> <form name="scoresheetform" action=""> <div id="Submitbutton" style="position:absolute; left:52px; top:87px; width:110px; height:33px; z-index:1"> <input type=submit name="Submitbutton" value="Submit Form"></div> <div style="position:absolute; left:9.822px; top:37px; width:45px; height:29px; z-index:2"> <input id="HomePlayer1Rnd6Pnts" name="HomePlayer1Rnd6Pnts" onBlur="verify_score('HomePlayer1Rnd6Pnts')" size=3></div> <div style="position:absolute; left:79.822px; top:37px; width:45px; height:29px; z-index:3"> <input id="HomePlayer1Rnd7Pnts" name="HomePlayer1Rnd7Pnts" onBlur="verify_score('HomePlayer1Rnd7Pnts')" size=3></div> <div id="HomePlayer1TotalPnts" style="position:absolute; left:146px; top:37px; width:45px; height:29px; z-index:4"> <input name="HP1 Total Points" size=3></div> </form> </div> </body> </html> All, I have the following code: Code: <script type="text/javascript"> alert("This picture has received more then 10 down votes so it is now being deleted. You will be redirected back to the pictures page!"); </script> <? echo "<meta http-equiv=\"refresh\" content=\"2;url=http://website.com/pictures.php\">"; ?> This is just in the code. I thought it would just execute this but it doesn't. I can't have it appear on a button event or an onload since this snipped gets executed with AJAX. How can I make it appear? Thanks in advance! Hi, I have this code: var finalsort="("+getvalue+","numvalue")\n" alert(finalsort) however, it is then alerted three seperate times (as it is in a for loop) but i would like this to be displayed in an alert: (david,5) (james,3) (tom,1) How would I do this, am I doing something wrong with the \n? thanks Hi, How can i call a javascript alert function from an if condition in PHP? For instance: if (A == B) { CALL alert(); } thanks Hi I have create a website where many features do not support IE versions, Can someone help me on javascript code that can alert the user to use Netscape to access my website.. I mean Javscript alert code that will recommend the user to use netscape to access my website .. Any help will be much appreciated May I put some style to an alert box ? for example . <html> <head> <style> #box { font-style: strong } </style> <script lenguaje="javascript"> var age; age = prompt("Type age : ", ""); if (edad<18) { <div id=box alert("Underage, get out !")> </div> } else { alert("You are Welcome, surf it it"); } </script> </head> </html> Thanks I need to alert the answer 31 but keep getting 34. It has to go like this ticket*reward+cost. It would be 24+4+3=31. I would need to times the tickets by rewards then add the cost after. How would I alert this? Code: <html> <head> <link rel="stylesheet" type="text/css" href="movie_ticket.css" /> <title>Movie</title> <script type="text/javascript"> function ticketOrder() { var cost; var ticket; var reward; var movie; movie=document.movieTicket.selUpcomingMovie.value; if(document.movieTicket.radTicket[0].checked) { ticket=document.movieTicket.radTicket[0].value; ticket=parseInt(ticket); } if(document.movieTicket.radTicket[1].checked) { ticket=document.movieTicket.radTicket[1].value; ticket=parseInt(ticket); } if(document.movieTicket.radTicket[2].checked) { ticket=document.movieTicket.radTicket[2].value; ticket=parseInt(ticket); } if(document.movieTicket.radTicket[3].checked) { ticket=document.movieTicket.radTicket[3].value; ticket=parseInt(ticket); } if(document.movieTicket.radTicket[4].checked) { ticket=document.movieTicket.radTicket[4].value; ticket=parseInt(ticket); } if(document.movieTicket.radReward[0].checked) { reward=document.movieTicket.radReward[0].value; reward=parseInt(reward); } else if(document.movieTicket.radReward[1].checked) { reward=document.movieTicket.radReward[1].value; reward=parseInt(reward); } if(document.movieTicket.chkPopcorn.checked) { var popcorn=document.movieTicket.chkPopcorn.value; popcorn=parseInt(popcorn); cost=popcorn; } if(document.movieTicket.chkSoda.checked) { var soda=document.movieTicket.chkSoda.value; soda=parseInt(soda); cost=soda; } if(document.movieTicket.chkCandy.checked) { var candy=document.movieTicket.chkCandy.value; candy=parseInt(candy); cost=candy; } alert(ticket*reward+"cost"); } </script> </head> <body> <div id="Header"> <h2>The Chicago Movie Palace</h2> <p><h2>We have the best ticket prices!!</h2></p> </div> <div id="main_content"> <form name="movieTicket"> How many tickets would you like to order?<br /> 1 Ticket<input type="radio" name="radTicket" value="1" /><br /> 2 Tickets<input type="radio" name="radTicket" value="2" /><br /> 3 Tickets<input type="radio" name="radTicket" value="3" /><br /> 4 Tickets<input type="radio" name="radTicket" value="4" /><br /> 5 Tickets<input type="radio" name="radTicket" value="5" /><br /> Are you a member of our theater?<br /> Yes<input type="radio" name="radReward" value="8" /><br /> No<input type="radio" name="radReward" value="10" /><br /> Would you like any food or drinks with your movie?<br /> Popcorn ($4)<input type="checkbox" name="chkPopcorn" value="4" /><br /> Soda ($3)<input type="checkbox" name="chkSoda" value="3" /><br /> Candy ($3)<input type="checkbox" name="chkCandy" value="3" /><br /> Which movie would you like to see? <select name="selUpcomingMovie"> <option value="Immortals">Immortals</option> <option value="J Edgar">J Edgar</option> <option value="Sherlock Holmes:A Game of Shadows" >Sherlock Holmes:A Game of Shadows</option> </select> <p><input type="button" name="btnSubmit" value="Order Tickets" onclick="ticketOrder()" /></p> </div></form> <div id="location_info"> <p><span class="highlight">4789 N. Potterville St.</span></p> <p><span class="highlight">Telephone Number 1-312-589-6217</span></p> </div> </body> </html> Hey! First off you guys rock! Second im a massive noob - like beyond noob. Ok so heres the deal guys and gals: I use Kampyle (a feedback form thing) and when my viewers click my feedback button a new window pops up and is the form. Like this (plus thats my site if you want to try it): However! theres this site (yes my arch enemy, well were actually two different things and hey i dont even speak their language) and they use the same feedback thing by Kampyle too. But the catch is theirs is inbuilt. something like Lightbox Javascript but for forms/windows. or Facebook's popup notices? so theirs looks like this: This make me ANGRY!!! cause i want that and ive had to ask stupid people cause you guys and gals are way too advance for me... well i am only 17... anywho... WHO CAN HELP ME??? if you want to test the difference between the two forms, my site: that creative corner and click the feedback button. their site:Lyoness and click the feedback button in the bottom right corner. THANK YOU SO MUCH!!! The alert at the top of this function will not show... Code: function getXmlHttpRequestObject() { alert("HTTP XML REQUEST!"); var httpxml; if (window.XMLHttpRequest) { // code decent browsers like Firefox, Chrome, Opera, Safari. And IE7+... httpxml = new XMLHttpRequest(); return httpxml; } else { if (window.ActiveXObject) { //Code for crap like IE httpxml = new ActiveXObject('Microsoft.XMLHTTP'); return httpxml; } else { httpxml = null; } } if (httpxml == null) { document.getElementById('p_status').innerHTML = "Status: Could not create XmlHttpRequest Object, please upgrade your browser!"; return null; } else { return httpxml; } Ok, this HAS to be some stupid typo I can't find somewhere or something but I don't see where. Basically the alertbox works just fine when only the show_alert() function and the button calling it are in the code. But neither work if only the alert() function and the button calling that are in the code, nor does it work by itself. However I see no differences in how they are coded unless I am missing something very very simple. Code: <html> <head> <script type="text/javascript"> function show_alert() { alert("I am an alert box!"); } function alert() { alert("again"); } </script> </head> <body> <input type="button" onClick="show_alert()" value="Show alert box" /> <input type="button" onClick="alert()" value="CLICK me" /> </body> </html> i need the system to think its getting an alert without actualy presenting an alert on the page. i found this but i guess i dont really understand how it works Code: function foo() { doSomething(); fakeAlert("Alert! Alert!", doSomethingAfterTheAlertIsCleared); } i hate to have to do hacks to get something to work but for some reason my simple js will not work without an alert Code: <script type="text/javascript"> <!-- function process_acount() { alert("about to send data"); document.bbautoreg.submit(); } // --> </script> it works perfectly with the alert and the comment if i remove the alert, it wont work, if i remove the <!-- it wont work, if i have the alert without the comment <!-- it wont work. i thought maybe there might be something wrong with the js interpreter i even changed it from html to php using echo for the js and still the same unless i can get this to work i will have no other choice but to use a fake alert why would having an alert make a dif anyway, seems to me thats just crazy, that itself should have no bearing on if it executes or not. Anyone know why that would matter. <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Color Changer</title> <link href="style.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> window.alert("The page is loading."); </script> </head> <body> <form> <p>Click the button to turn the page: <input type="button" value="Red" onclick="document.bgColor='red';" window.alert("Background is now red.");> </p> <p>Double click the button to turn the page: <input type="button" value="Green" ondblclick="document.bgColor='green';"></p> <p>Click down on the button to turn the page: <input type="button" value="Orange" onmousedown="document.bgColor='orange';"></p> <p>Release the mouse while on the button to turn the page: <input type="button" value="Blue" onmouseup="document.bgColor='blue';"></p> <p> Black button: <input type="button" value="Black" onmousedown="document.bgColor='black';" onmouseup="document.bgColor='white';"></p> </form> <hr> </body> </html> Is it possible to change the "OK" text in an alert confirm box ?
When you do an alert confirm you can make if statements to say if they click ok do this and if they click cancel stop the program. Well I am trying to make a prompt that first asks the user to enter in a url and after they do and click enter they url is wraped with img tags. I would like to make it so that if the user clicks cancel the program ends b/c right now if the user click okay with no value the result is [img][/img] and if the user clicks cancel the result is [img]null[/img]. Any step in the right direction would be greatly appreciated! PHP Code: <script language="javascript"> function imgGenerator(){ var question=confirm("Would you like to share an image?"); if (question==true){ var obj=document.getElementById("mngl-board-post-input"); var imgurl = prompt("To Share an image paste the image url here"); var txt=document.createTextNode("[img]"+imgurl+"[/img]"); obj.appendChild(txt); } else {} } </script> thanks this problem has been solved
<html> <head> Filename: oae.htm Supporting files: figa.jpg, figb.jpg, figc.jpg, figd.jpg, figures.jpg, functions.js, oae.jpg, quiz.css --> <title>Online Aptitude Quiz: Page</title> <link href="quiz.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="functions.js"></script> <script type="text/javascript"> var seconds = 0; var clockId; var quizclock; function runClock() { seconds++; quizclock = seconds; document.quiz.quizclock.value = seconds; } function startClock() {showQuiz(); clockId = setInterval("runClock()",1000); } var timer; function stopClock() { clearInterval(runClock); var correctAns = gradeQuiz(); alert("You have Code: correctAns correct of 5 in Code: timer seconds."); } </script> </head> <body> <form id="quiz" name="quiz" action=""> <div id="header"> <p><img src="oae.jpg" alt="Online Aptitude Exam" /> <span>Grunwald Testing, Inc.</span><br /> 1101 Science Drive<br /> Oakdale, CA 88191 </p> </div> <div id="intro"> <p>This is a timed quiz of intelligence and perception. Your final score will be based on the number of correct answers and the time required to submit those answers.</p> <p>To start the quiz click the <b>Start Quiz</b> button below, which will reveal the first page of quiz questions and start the timer. When you have completed the questions, click the <b>Submit Answers</b> button on the quiz form.</p> <p id="buttons"> <input type="button" value="Start Quiz" onClick="startClock()" /> <br /> <input name="quizclock" id="quizclock" value="0" /> </p> </div> <div id="questions"> <h1>Page 1: Pattern Recognition</h1> <table id="quiztable"> <tr> <th rowspan="3">1.</th> <td colspan="2">Enter the next number in this sequence: 1, 3, 4, 7, 11, 18, ...</td> </tr> <tr> <td><input type="radio" name="q1" />a) 22</td> <td><input type="radio" name="q1" />c) 28</td> </tr> <tr> <td id="cor1"><input type="radio" name="q1" />b) 29</td> <td><input type="radio" name="q1" />d) 32</td> </tr> <tr> <th rowspan="3">2.</th> <td colspan="2">Enter the final three numbers in this sequence: 8, 5, 4, 9, 1, 7, 6, ...</td> </tr> <tr> <td id="cor2"><input type="radio" name="q2" />a) 10, 3, 2</td> <td><input type="radio" name="q2" />c) 2, 3, 10</td> </tr> <tr> <td><input type="radio" name="q2" />b) 2, 10, 3</td> <td><input type="radio" name="q2" />d) 10, 2, 3</td> </tr> <tr> <th rowspan="3">3.</th> <td colspan="2">Enter the next letter in this sequence: j, f, m, a, m, j, j, ...</td> </tr> <tr> <td><input type="radio" name="q3" />a) j</td> <td><input type="radio" name="q3" />c) f</td> </tr> <tr> <td><input type="radio" name="q3" />b) m</td> <td id="cor3"><input type="radio" name="q3" />d) a</td> </tr> <tr> <th rowspan="3">4.</th> <td colspan="2">What letter in this set does not belong?: A, B, D, G, J, S, O</td> </tr> <tr> <td id="cor4"><input type="radio" name="q4" />a) A</td> <td><input type="radio" name="q4" />c) J</td> </tr> <tr> <td><input type="radio" name="q4" />b) B</td> <td><input type="radio" name="q4" />d) O</td> </tr> <tr> <th rowspan="3">5.</th> <td colspan="2">What is the next figure in the following sequence?:<br /> <img src="figures.jpg" alt="" /> </td> </tr> <tr> <td><input type="radio" name="q5" />a) <img src="figa.jpg" alt="" /></td> <td><input type="radio" name="q5" />c) <img src="figc.jpg" alt="" /></td> </tr> <tr> <td><input type="radio" name="q5" />b) <img src="figb.jpg" alt="" /></td> <td id="cor5"><input type="radio" name="q5" />d) <img src="figd.jpg" alt="" /></td> </tr> <tr> <td colspan="3" style="text-align: center"> <hr /> <input type="button" value="Submit Answers" onClick="stopClock()"/> </td> </tr> </table> </div> </form> </body> </html> How would you make a alert box that contains a tabel instead of writting?
This is all php except for the java code I am struggling with. Please advise. I have tried this 2 ways and have spent hours on something that should be simple. I have a string that I am trying to display in an alert box with an onclick method 1: $mystring = "<a href=\"mysite.com\">Click</a>"; this does not work echo "<input type='button' value='Grab Code' onClick=alert('$mystring')>"; nor does this echo "<input type='button' value='Grab Code' onClick=alert('".$mystring."')>"; nor does anything I try. All I want to do is display the value of mystring in an alert box. However, this does work .. echo "<script type='text/javascript'> alert('".$mystring."');</script>"; But I cannot call this from an onclick. Any help is appreciated. Thanks JT Hi I've had this script for a few years which I use to make a search box, it adds the user's search to the end of a url, so you can make a search box for Google or pretty much anything. If the user clicks on submit ('Find') without selecting a pull down option I like the script to alert something like 'select a site' or if they don't enter any keyword to alert 'enter a keyword', however when either of these happens, the alert box needs to be clicked several times to get rid of the alert. so I'm wondering if the script is running in some kind of loop.... The script does what I wat I just want to make the alert boxes go after the first 'click' to hide them... hope this makes sense here's the script, thanks for any ideas folks.. --------------------- ---------------- searchdata.js ---------------- [CODE] function addplus(items) { var plussed = ""; for (var t = 1 ; t <= items.length ; t++) { if (items.substring(t-1,t) == " ") { plussed+="+"; } else { plussed+=items.substring(t-1,t); } } return plussed; } function searchdata() { var words; words = document.getElementById("querydata").value; var searchitems; searchitems=addplus(words); var index; index = document.getElementById("subjectdata").selectedIndex; collection = document.getElementById("subjectdata").value; if (document.getElementById("subjectdata").value == "null" || document.getElementById("subjectdata").value == "") {alert("\nSelect a site to search");} else { var site; site = document.getElementById("subjectdata").value; site+=searchitems; if (notEmpty(searchitems)) { window.open("","newwin","status=0,resizable=1, menubar=1, toolbar=1, scrollbars=1, location=1, directories=0, width=900, height=600, top=200, left=200"); window.open(site,"newwin"); } } } function notEmpty(word) { if (word == "" || word == null) { alert("\nEnter a keyword to search"); document.getElementById("querydata").focus(); return false; } else { return true; } } [CODE] ----------------------------------------------------------------- the form to display the search box --------------------------------- [CODE] <script src="searchdata.js" type="text/javascript"></script > <form id="searchform" onsubmit="searchdata()" action="javascript:searchdata()" method="get"> <select id="subjectdata"> <optgroup> <option select="selected" value="null">Choose coverage</option> <option value="http://www.statistics.gov.uk/hub/search/index.html?newquery=">National Statistics</option> <option value="http://www.intute.ac.uk/cgi-bin/search.pl?Search=Search&limit=0&subject=Statistics&term1=">Statistics & Data on the WWW</option> </optgroup> </select> <input id="querydata" value="type here" /> <input onkeypress="searchdata()" onclick="searchdata()" type="submit" value="Find" /> </form> [CODE] |