JavaScript - Why Is The Alert Didn't Working?
hye all,
it's me again. i have a little bit confusion here. why is this alert "alert("Please answer the question.");" did not prompt out even if i don't select any of the radio button?can anyone help me? i appreciate if someone can help me.TQ. Here is the coding to return the radio buttons' value: Code: function getSelectedValue(flds) { var i = 0; var len = flds.length; while (i < len) { if (flds[i].checked) { return flds[i].value; } i++; } return ""; } Below is the coding to calculate the radio button value: Code: var bdpr=0,bdft=0,bdbs=0,prft=0,prbs=0,ftbs=0; var rank= new Array(); var form = document.forms.Calculator; var bdpr = Number( getSelectedValue(form.elements.a) ); var bdft = Number( getSelectedValue(form.elements.b) ); var bdbs = Number( getSelectedValue(form.elements.c) ); var prft = Number( getSelectedValue(form.elements.d) ); var prbs = Number( getSelectedValue(form.elements.e) ); var ftbs = Number( getSelectedValue(form.elements.f) ); if ( isNaN(bdpr)|| isNaN(bdft) || isNaN(bdbs) || isNaN(prft) || isNaN(prbs) || isNaN(ftbs)){ alert("Please answer the question."); } else{ brand=1+bdpr+bdft+bdbs; price=1+1/bdpr+prft+prbs; feature=1+1/bdft+1/prft+ftbs; basic=1+1/bdbs+1/prbs+1/ftbs; window.open("try.html"); } Similar TutorialsI have attempted several variations of this, none of which seem to help. I have narrowed this down to being the central problem at hand. Do i just have something out of place? Code: if (monthly_pay>=1000) {bank_account="Okay";} else if ((monthly_pay>=700)&&(monthly_pay<=999)) {bank_account="Still Okay";} else if ((monthly_pay>=500)&&(monthly_pay<=699)) {bank_account="Start to worry";} else if ((monthly_pay>=300)&&(monthly_pay<=499)) {bank_account="Panic";} else if (monthly_pay<=299) {bank_account="Chapter 9";} else {document.write("Marry Up")} } Optionally, could I not do else if and somehow use this as a Nested If? Any help appreciated, Thank You I am trying to get the total of the checkboxes selected when the user clicks the "calculate total" button. It isn't working though. What am I doing wrong? Code: <html> <head> <script type="text/javascript"> function calculate(f) { var nums = f.num; var ntext = f.numtext; var nitem = f.numitem; var result = 0; var items = ''; for(var i=0;i<nums.length;i++) { if(nums[i].checked) { result+=parseFloat(ntext[i].value); items+=nitem[i].value+'\n'; } } f.answer.value=result; } if (nums[i].checked) { window.alert("Your total is " + f.answer.value=result;); } </script> </head> <body> <style type="text/css"> .box1 { float:left; width:500px; clear:left; } .box2 { float:left; padding-left:50px; } </style> <form name="myform"> Build your own family meal<br> <div class="box1"> <input type="checkbox" name="num" onclick="calculate(this.form)"> <input type="hidden" name="numtext" value="24.00" onchange="calculate(this.form)"> <input type="hidden" name="numitem" value="pencil" onchange="calculate(this.form)"> <div class="box2">Chicken Enchiladas $24.00</div> </div><br> <div class="box1"> <input type="checkbox" name="num" onclick="calculate(this.form)"> <input type="hidden" name="numtext" value="15.00" onchange="calculate(this.form)"> <input type="hidden" name="numitem" value="pen" onchange="calculate(this.form)"> <div class="box2">Rice and Beans $15.00</div> </div><br> <div class="box1"> <input type="checkbox" name="num" onclick="calculate(this.form)"> <input type="hidden" name="numtext" value="6.00" onchange="calculate(this.form)"> <input type="hidden" name="numitem" value="paper" onchange="calculate(this.form)"> <div class="box2">Chips and Salsa $6.00</div> </div><br> <div class="box1"> <input type="submit" name="answer" value="Calculate Total" onclick="calculate(f)" /> </div> </form> </body> </html> Working on a project and I am trying to get error messages to pop up when either a number wasn't entered or another error message if nothing was entered. otherwise if a number was probably entered it would perform the proper function, heres where I am at, does anyone know what is wrong with it? it wont calculate or even throw up a pop up box. Code: <script language="JavaScript" type="text/javascript"> function check_numbers(){ var sal = document.temp_form.num3.value; var error_message = ""; if (sal == "") { error_message += "You must enter a value gross annual salary \n"; } else if (isNaN(sal)) error_message += "Value entered is not a number, please try again. \n"; } if (error_message != "") { alert ("Please correct the following errors: \n_________________________________\n\n" + error_message); } else{ Calculate( parseInt(sal)) } } function calculate() { var sal = Number(document.getElementById('num3').value); var fName = document.getElementById('num1').value; var lname = document.getElementById('num2').value; alert('Hello '+ fName + ' '+ lname + ', you would pay $'+ sal * .2 + ' in Federal taxes and $'+ sal * .1 + ' in State taxes, leaving you $'+ sal * .7 + ' to take home annually!'); } And then here is the HTML part of it. Code: <b> Here is a pay slip generator that will determine your net annual salary. <br> Simply type in your first and last name along with gross salary and hit calculate. <br> Doing this will let you know how much you will end up paying in both Federal and State taxes. </b> <form action="" method="post" name="temp_form"> <p> Enter your First Name: <input name="num1" type="text" id="num1" size="10" maxlength="10"> </p> <p> Enter your Last Name: <input name="num2" type="text" id="num2" size="10" maxlength="10"> </p> <p> Enter your gross salary: <input name="num3" type="text" id="num3" size="10" maxlength="10"> </p> Click this button to calulate your annual net pay! <input type="submit" onclick="check_numbers()" value="Generate Pay Slip" /> <input type="button" value="Reset Form" onClick="this.form.reset()" /> </FORM> </body> </html> I have used this formula before, for some reason it isnt working properly. If the value is equal to 0 it will give an alert and return false. Then if you change the value of the drop down it won't let you submit. Does anyone see anything wrong? Code: <script type="text/javascript"> <!-- function validate_form ( ) { valid = true; if ( document.week_picks.blowout.value == "0" ) { alert ( "Please Select a Blowout" ); } return false; } //--> </script> Code: <form name="week_picks" method="post" action="confirm.php" onsubmit="return validate_form()"> <select id="blowout" name="blowout"> <option value="0">..</option> .... </select> Thanks for any help. I solved the issue by completely removing the LINK, and simply adding the onclick function. thank you anyway. -------------------------------- I'm sorry if perhaps my first post was to confusing, I hope I can better describe what I'm trying to achieve here. Here's what's going on. When a link is 'clicked' such as Code: <a href="javascript:animatedcollapse.toggle('test')"> I expand and Collapse!</a> it will 'expand' and 'collapse' a DIV. The script works completely fine, unless I try to place a Code: <input type="button" value="myButtonValue" /> as the link, so I can submit the information through a php request. if I use an image, or text, it works fine, but I need to be able to use a button. You can see an example of a working and non-working 'collapsing and expanding DIV' if you Click Here. Is there another way around this? I'd even venture to use another form of 'expanding' and 'collapsing' JavaScript if anyone could provide... Thank you. I 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. Thanks to this forum, I finally got my calculator working and want to share it with everyone who can use it. The code below divides the time input by the distance input and displays the resulting pace in a min:sec format. Enter 12 miles, for example, and 1 hour, 33 minutes and 15 seconds, and the code displays 7:46 mpm (minutes per mile). My first version uses one function to do everything, but this morning I decided to teach myself how one function passes stuff to another. So I began trying to perform the min:sec conversion in a function named Pace2minsec and pass the result to the Pace function for display in the form. After several failures, I learned that a function returns its calculation to whatever code calls it. Ah ha, I thought, I need to have Pace call Pace2minsec. Yeah, pretty basic stuff but I am a raw beginner with Javascript, and thought there might be others here like me who could benefit from my mistakes. Even after discovering the call-return process, I had to get the names of the variables correct before it would work. One mistake I made was thinking that I could have a variable with the same name in both functions. Wrong. Even though they were both inside their own function and therefore local variables, apparently, since one function called the other, the names had to be different. In both functions, I had a variable named totalsec, but only when I renamed it totalseconds in the first function did my code work. Another glich was discovering that I had to tell the second function what variable it had to use for its operation. My first stab at that was to put the line Pace2minsec(minsec) in the first function. Wrong. Then I tried Pace2minsec(totalsec). Wrong again. And finally, Pace2minsec(totalseconds) which worked fine. Probably obvious to most, but it sure wasn't to me. Trial and error scripting! But I'm getting there, one principle at a time... <CODE> <html> <head> <script> function Pace(D, H, M, S, form) // Is form really necessary? { var dist = parseFloat(D); // Makes entry a number? var hours = parseFloat(H); var mins = parseFloat(M); var secs = parseFloat(S); var pacedecimal = (hours*60 + mins + secs/60) / dist; // Total minutes in decimal var totalseconds = pacedecimal*60; // Total seconds in decimal form.pace.value =Pace2minsec(totalseconds) + " " + "mpm"; // Tell Pace2minsec what variable to use? } function Pace2minsec(totalsec) { var minsec = ''; sec = Math.round(totalsec%60); // remainder of totalsec div by 60 min = Math.round((totalsec-sec)/60); // total seconds minus remainder minsec = min + (sec>9?":":":0") + sec; // min:sec format adds :0 if sec<10 return(minsec); // Pass min:sec format to Pace, the calling function } </script> </head> <body style="margin-top:100px; text-align:center; font-family:arial; background-color:silver;"> <form name="pacer"> <table style="font-size:14px; font-weight:bold;" cellspacing="0" border="0"> <tr> <td>DIST</td> <td><input type="text" name="dist" size="3"></td> <td width="8"></td> <td>TIME</td> <td><input type="text" name="hours" size="1">:</td> <td><input type="text" name="mins" size="1">:</td> <td><input type="text" name="secs" size="1"></td> <td width="24"></td> <td><input TYPE="button" VALUE="Pace" onClick="Pace(this.form.dist.value, this.form.hours.value, this.form.mins.value, this.form.secs.value, this.form)"></td> <td width="4"></td> <td><input type="text" name="pace" size="8"></td> <td width="6"></td> <td><input TYPE="reset" VALUE="Clear" onClick="clearForm(this.form)"></td> </tr> </table> </form> </body> /html> </CODE> Code: <html> <head> <title>Variable - Examples 1</title> <script type="text/javascript"> function Student(firstName, lastName, email, courseID, titleArray, pointsArray){ this.firstName = firstName; this.lastName = lastName; this.email = email; this.courseID = courseID; this.title = titleArray; this.points = pointsArray; this.assign = this.points.slice(0,4); this.exams = this.points.slice(-2); this.assignments = function() { return task(this.title,this.points); } this.totalPoints = function() {return addExam(this.assign,this.exams); } this.finalGrade = calcGrade; } Student.prototype = { constructor : Student, toString : studentInfo }; //assign and exam doesn't seem to hold no values inside.. ??? function addExam(assign,exams){ var exams=this.exams; var high1=exams[0]; var high2=0; while(high2<exams.length){ high1=Math.max(high1,exams[high2]); high2++; } var sum = 0; for (var i=0; i < assign.length; i++){ sum += assign[i]; } return sum + high1; } var totalPoints = addExam(); function calcGrade(){ var grade; if (totalPoints >= 190){ return "A+"; }else if (totalPoints >= 180){ return "A"; }else if (totalPoints >= 175){ return "B+" }else if (totalPoints >= 170){ return "B"; }else if (totalPoints >= 165){ return "B-"; }else if (totalPoints >= 160){ return "C"; }else if (totalPoints >= 150){ return "D"; }else if (totalPoints < 150){ return "F"; } } function studentInfo(){ return "Student : " + this.lastName + "," + this.firstName + "<br>"+ "eMail : " + this.email + "<br>" + "Course ID : " + this.courseID + "<br>" + "--------------------------------" + "<br>" + this.assignments() + "--------------------------------" + "<br>" + "Total Points : " + this.totalPoints() + "<br>" + "Final Grade : " + this.finalGrade(); } function createStudents(){ var student1 = new Student("Jake", "Hennry", "jhennery@gmail.com","COIN-070B.01", ["Assignment1","Assignment2","Assignment3","Assignment4","Assignment5","MidTerm", "Final"], [25, 25, 28, 20, 29, 40, 40] ); alert("Student : " + student1.lastName + "," + student1.firstName + "\n"+ "eMail : " + student1.email + "\n" + "Course ID : " + student1.courseID + "\n" + "---------------------------------------" + "\n" + student1.assignments() + "\n" + "---------------------------------------" + "\n" + "Total Points : " + student1.totalPoints() + "\n" + "Final Grade : " + student1.finalGrade()); } var titleArray = ["Assignment1","Assignment2","Assignment3","Assignment4","Assignment5","MidTerm", "Final"]; var pointsArray = [30, 30, 28, 27, 29, 41, 45]; var student = new Student("Haripriyaa", "Ganesan", "haripriyaa@gmail.com","COIN-070B.01", titleArray, pointsArray ); </script> </head> <body> <script type="text/javascript"> document.writeln(student.toString()); </script> </body> </html> 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 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 Is it possible to change the "OK" text in an alert confirm box ?
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> 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> <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> 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 Hi, How can i call a javascript alert function from an if condition in PHP? For instance: if (A == B) { CALL alert(); } thanks 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. 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; } |