JavaScript - Gettin Results In Alert Box And On New Page
currently working on a project and I cant figure the right coding to get my results to pop up in a new page, same window AND an alert box. I got the alert box part down perfectly but cannot figure out how to get my results. Even if i can figure out how to get them on the same page in their designated field, I can probably figure the rest out, the coding i have so far looks like this: ( i cant figure out how to make it look cool in a diff. window... sorry)
<HTML> <HEAD> <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"> <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="#" id="num3" size="10" maxlength="10"> </p> Click this button to calulate your annual net pay! <script type="text/javascript"> function calculate() { var fName = document.getElementById('num1').value; var lname = document.getElementById('num2').value; var sal = Number(document.getElementById('num3').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!'); //for testing } </script> <input type="button" onclick="calculate()" value="Generate Pay Slip" /> <input type="button" value="Reset Form" onClick="this.form.reset()" /> <p>Total federal taxes: <input name="num4" type="#" id="num4" size="10" maxlength="10" value= N/A> </p> <p>Total State taxes: <input name="num5" type="#" id="num5" size="10" maxlength="10" value= N/A> </p> <p>Net annual salary: <input name="num6" type="#" id="num6" size="10" maxlength="10" value= N/A> <script type="text/javascript"> function show_results { var ftax = document.getElementbyId('num4').value; var stax = document.getElementbyId('num5').value; var npay = document.getElementbyId('num6').value; } </TEXTAREA> </FORM> </body> </html> </script> Any clues would be very helpful 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. Hi Guys, seen some pages who give alerts or Warnings mentioning that i'm moving away from my webpage. Best example is hotmail when you are on the compose mail screen and when click another link it is asking for confirmation. Can you one please shed some light on how to do this. Your help is greatly appreciated. Cheers Dileep Hell All Can some1 give me a function for Alert Visitor before the page Load if he /she Sure wants to See the Page . I have function Onclick alert message but i want the function is when click and go to the page and before the page load to ask 'if want realy to see the page' if yes return true if cancel or no to go back to where he come from. Thank you and hope such function exist. Bear with me, as I do not know where the problem lies. I know this is a lot of code. I have acquired this code and am not sure what to change to make it work how I want it to. Basically it prompts, with a Javascript alert, for the visitor to take a survey. If they hit OK it redirects them to a landing page, if they hit CANCEL it lets them go on their way. FIRST OFF THANK YOU SOOOO MUCH FOR ANY HELP YOU CAN PROVIDE ME!!! I would like for the script to execute even when the visitor types a URL in the address bar and exits that way versus just alerting the visitor when they click an external link. That is the main goal that I need help with. I would also like the script to use cookies so that it doesn't pop up for a visitor more than once in either 7 or 14 days. This isn't as big of a deal as the problem listed above but is more of a bonus if I can get it. I have listed all pages with code that pertain to this code because, as listed above, I do not know where the problem lies. If it helps, this code is also based off of the jQuery code. Below is the page where the code executes: Code: <html> <head> <script src="SurveyRelocationManager.js"> <!-- --> </script> <script type="text/javascript" src="jquery.js"></script> <script> <!-- var srm; function init(){ srm = new SurveyRelocationManager(); srm.setSurveyURL("http://www.poddcorp.com"); //change to the correct survey URL //add the internal URLs, if internal popup does not deploy srm.addInternalURL("https://secure3.convio.net/ucs/site/Advocacy/"); srm.addInternalURL("http://ucs.convio.net/site/Ecard/"); srm.addInternalURL("https://secure3.convio.net/ucs/site/Donation/"); srm.addInternalURL("http://ucs.convio.net/site/UserLogin/"); srm.addInternalURL("http://ucs.convio.net/site/PageServer?pagename=sign_up/"); srm.addInternalURL("http://www.ucsusa.org/"); $("a").click(function () { return srm.onBeforeClick(this); }); } window.onload = init; --> </script> </head> <body> <a href="http://www.ucsusa.org/internal.html">internal</a><br /> <a href="http://www.themmrf.org/donate-now-take-action/join-an-event/powerful-athletes/mmrf-triathlon-and-cycling.html">external link</a><br /> <a href="internal.html">internal</a><br /> <a href="http://www.yahoo.com">external link</a><br /> <a href="http://www.ucsusa.org/global_warming/">another internal</a> </body> </html> Below is other code (SurveyRelocationManager.js) that helps execute the script: Code: function SurveyRelocationManager(){ //Constr. this.aInternalURLs = new Array(); } SurveyRelocationManager.prototype.init = function(){ this.setInternalURLs(); } SurveyRelocationManager.prototype.setSurveyURL = function(s){ this.sSurv = s; } SurveyRelocationManager.prototype.getSurveyURL = function(){ return this.sSurv.valueOf(); } SurveyRelocationManager.prototype.addInternalURL = function(s){ this.aInternalURLs.push(s); } SurveyRelocationManager.prototype.removeInternalURL = function(s){ for(var a = 0; a<this.aInternalURLs.length; a++){ if(this.aInternalURLs[a] == s){ this.aInternalURLs.splice(a, 1); } } } SurveyRelocationManager.prototype.getInternalURLs = function(){ return this.aInternalURLs.slice(0); } SurveyRelocationManager.prototype.getURLIsInternal = function(s){ var t; /* KLUDGE: t.indexOf returns -1 if aInternalURLs has no slash at the end. Somehow forward slashes cancels the eval. TODO: Refactor t.indexOf. */ for(var a = 0; a<this.aInternalURLs.length; a++){ t = this.aInternalURLs[a]; // if(s.indexOf(t) != -1){ return true; }else if(s.indexOf('http://') == -1) return true; } return false; } SurveyRelocationManager.prototype.onClick = function(o){ var b = this.getURLIsInternal(o.toString()); if(!b){ var c = confirm("Do you want to take the survey?"); if(c){ //TODO: Relocate here. document.location = this.getSurveyURL(); } else { return true; } } else { return true; } return false; } Note: The only other page that isn't located on this post is the jQuery code. Because of it's length it wouldn't allow me to include the code. You can visit jquery.com to view the code. Or message me and I can send it. THANKS A MILLION! Hi, Can anyone please tell me that " how to write a JavaScript function to pop up an alert() if a user scrolls down the webpage faster than a certain speed" Looking forward for a urgent reply Thanks I'm writing a calculator script that will need user input (how much they pay on internet, phone or cable bill) and then multiply those numbers by a known rate and then show the customer the new number. I have the math setup (working right now), and the script works to spit out the answers in an alert. Instead of the alert (which is the only thing I can do correctly at this point), I need the script to give the answers for each bill and then a total answer at the bottom. The script is here, it's all in the index file. http://gotsmith.com/calculator/ Thanks. Hi there guys! My group is working on a basic document management system that includes four users. staff member, department director, division chief and clerk. The programming language that we used is PHP. when staff member logs-in on his homepage and uploads a file he must choose reviewer from a dropdown menu that consists of dep. director and div. chief. When he clicks the upload button the homepage of who he chose as reviewer should receive a prompt/alert box upon log-in saying "you have a document to review". For example: if he chose division chief as the reviewer when the person logs-in on his homepage a prompt/alert should display that he has something to review. The code for uploading file is already up and working. We are looking for advice on how to integrate javascript in this system. Especially in the prompt part. thanks for your ideas. how i can refresh my main history page without page refresh alert message? i am using the following code on the submitpage.asp <%response.write ("<script>window.location.reload(history.go(-2));</script>")%> i got the attached message when it refreshes the main page. is there is a way to refresh directly without this message? Hi I have a problem with a form in my site he http://www.21centuryanswers.com/submit.php if no field is filled and you click submit, an alert will be shown, yet the next page will still load! How do I fix it? the code for the form is: <form action="privacy.php" method="post" onsubmit="return checkform(this);"> <fieldset> <center> E-mail: <input type="textfield" name="email" size="60" value="" /><br/></br> Question: <input type="textfield" name="question" size="70" value="" /><br/><br/> <input type="submit" value = "Submit"/> </center> </fieldset> </form> and here is the validation script: <script language="JavaScript" type="text/javascript"> <!-- function checkform ( form ) { // ** START ** if (form.email.value == "") { alert( "Please enter your email." ); form.author.focus(); return false ; } if (form.question.value == "") { alert( "Please enter the question." ); form.title.focus(); return false ; } // ** END ** return true ; } //--> </script> Please help! hello everybody, I need help about, I need to change the result to opening a url page. This script results in a value and I need the result to be open a url page. Can anyone help me?? <SCRIPT language="Javascript"> nome = new Array(4); nome[0] = new Array(4); nome[1] = new Array(4); nome[2] = new Array(4); nome[3] = new Array(4); nome[0][0]="1500"; nome[0][1]="1250"; nome[0][2]="1300"; nome[1][0]="800"; nome[1][1]="850"; nome[1][2]="900"; nome[2][0]="500"; nome[2][1]="520"; nome[2][2]="540"; nome[3][0]="400"; nome[3][1]="356"; nome[3][2]="234"; function affi() { document.form.txt.value=nome[document.form.liste.selectedIndex][document.form.taille.selectedIndex]; } </SCRIPT> <form name="form" class="texto" > Choose the article : <select name="liste"> <option>Camisas <option>Polos <option>T-shirts <option>base corporal </select> <br> Choose the size: <select name="taille"> <option>T. Small <option>T. Médium <option>T. Large </select> <br> <input type="button" value="Obter preço" onClick="affi(this.form)" name="button"> <br> <br> <input type="TEXT" name="txt"> </form> Thank's in advance rui Hi all!, I'm having a few challenges trying to create a link to a "new" search from a database search results page. This maybe a better example: My goal is: To allow website visitors to searches site for i.e. "Dog Collars", the results page lists every "dog collar" and store that carries "dog collars" (in database). At that point I would like to have links (on the results page) to all brands of "dog collars" and stores that carry "dog collars". I would like to then be able to click on a "brand" (text link) of "dog collars" and then generate a new results page that lists all store and vendor information. thank you in advance! Erick p.s. this is a link to a site that has a similar featu http://69.0.211.58/~pubexpress/ami/html/index.html Hi, Apologies in advance but I have no experience of Javascript. I found the following 'Cut & Paste Google Internal Site Search script' in the Javascriptkit.com library - it works well and provides an easy solution for adding a search function to a website - code below Code: <script type="text/javascript"> // Google Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use //Enter domain of site to search. var domainroot="www.javascriptkit.com" function Gsitesearch(curobj){ curobj.q.value="site:"+domainroot+" "+curobj.qfront.value } </script> <form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)"> <p>Search JavaScript Kit:<br /> <input name="q" type="hidden" /> <input name="qfront" type="text" style="width: 180px" />*<input type="submit" value="Search" /></p> </form> <p style="font: normal 11px Arial">This free script provided by<br /> <a href="http://www.javascriptkit.com">JavaScript Kit</a></p> However, if possible, I would like to display the results inside the website structure rather than on a new page - is there an easy way to do this? Thanks in advance for any help. I have a small form that I'm working on for a client. They want a form that their potential leads can fill out and then hit 'calculate rate'. Once this is done, the results should display on another page with a short summary of what their quote will be as well as some of the other information they filled out. It should also send an email to my client displaying the information that their lead just filled out. My only problem is I am not sure how to go about the calculation part. I know I would have to do an onSubmit, but how would I hide that calculation and then receive that number on another page. Here is the javascript for that form: Code: /* This source is shared under the terms of LGPL 3 www.gnu.org/licenses/lgpl.html You are free to use the code in Commercial or non-commercial projects */ //Set up an associative array //The keys represent the size of the cake //The values represent the cost of the cake i.e A 10" cake cost's $35 var practice_field = new Array(); practice_field["None"]=0; practice_field["Allergy and Immunology"]=4400; practice_field["Endocrinology"]=4400; practice_field["Pathology"]=4400; practice_field["Dermatology"]=4400; practice_field["Geriatrics"]=4400; practice_field["Physical Rehabilitation"]=4400; practice_field["Family Practice"]=6900; practice_field["General Practice"]=6900; practice_field["Internal Medicine"]=6900; practice_field["Oncology"]=6900; practice_field["Oral Surgery"]=6900; practice_field["Radiology"]=6900; practice_field["Gastroenterology"]=6900; practice_field["Infectious Disease"]=6900; practice_field["Nephrology"]=6900; practice_field["Ophthalmology"]=6900; practice_field["Pediatrics"]=6900; practice_field["Urology"]=6900; practice_field["Anesthesiology"]=9000; practice_field["Cosmetic Surgery"]=9000; practice_field["General Surgery"]=9000; practice_field["Neurology"]=9000; practice_field["Otolaryngology"]=9000; practice_field["Plastic Surgery"]=9000; practice_field["Vascular Surgery"]=9000; practice_field["Cardiology"]=9000; practice_field["Emergency Medicine"]=9000; practice_field["Gynecology"]=9000; practice_field["Orthopedic Surgery"]=9000; practice_field["Pain Management"]=9000; practice_field["Pulmonary Surgery"]=9000; practice_field["Neurological Surgery"]=9900; practice_field["Obstetrics"]=9900; //Set up an associative array //The keys represent the filling type //The value represents the cost of the filling i.e. Lemon filling is $5,Dobash filling is $9 //We use this this array when the user selects a filling from the form var society_member= new Array(); society_member["None"]=null; society_member["BCMA"]=0.10; society_member["DCMA"]=0.10; society_member["FOGS"]=0.10; society_member["FNS"]=0.10; society_member["PBCMS"]=0.10; society_member["FSPS"]=0.10; //This function finds the filling price based on the //drop down selection function getPracticeField() { var docPracticeField=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedPracticeField = theForm.elements["practice"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docPracticeField = practice_field[selectedPracticeField.value]; //finally we return cakeFillingPrice return docPracticeField; } //This function finds the filling price based on the //drop down selection function getSelectedSociety() { var docSelectedSociety=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the select id="filling" var selectedSociety = theForm.elements["society"]; //set cakeFilling Price equal to value user chose //For example filling_prices["Lemon".value] would be equal to 5 docSelectedSociety = society_member[selectedSociety.value]; //finally we return cakeFillingPrice return docSelectedSociety; } //candlesPrice() finds the candles price based on a check box selection function candlesPrice() { var candlePrice=0; //Get a reference to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includecandles" var includeCandles = theForm.elements["includecandles"]; //If they checked the box set candlePrice to 5 if(includeCandles.checked==true) { candlePrice=0; } //finally we return the candlePrice return candlePrice; } function insciptionPrice() { //This local variable will be used to decide whether or not to charge for the inscription //If the user checked the box this value will be 20 //otherwise it will remain at 0 var inscriptionPrice=0; //Get a refernce to the form id="cakeform" var theForm = document.forms["cakeform"]; //Get a reference to the checkbox id="includeinscription" var includeInscription = theForm.elements["includeinscription"]; //If they checked the box set inscriptionPrice to 20 if(includeInscription.checked==true){ inscriptionPrice=0; } //finally we return the inscriptionPrice return inscriptionPrice; } function calculateTotal() { //Here we get the total price by calling our function //Each function returns a number so by calling them we add the values they return together var cakePrice = getPracticeField() + null - (getPracticeField() * getSelectedSociety()) + candlesPrice() + insciptionPrice(); //display the result var divobj = document.getElementById('totalPrice'); divobj.style.display='block'; divobj.innerHTML = "Your Pre-Paid Legal Defense Fee Will Be Around $"+cakePrice; } function hideTotal() { var divobj = document.getElementById('totalPrice'); divobj.style.display='none'; } If you look at the bottom you can see where the Function that Calculates everything is. Right now it calculates onClick. I just want it to calculate after the user has filled out the form completely and display that calculation on another page along with the rest of the information they inputted. view the rest of my comments works on the first page but when i extend the search results the rest of the view comments wont expand. click View all 3 comments and it will show all comments then click more button try to click the view all comments on the next comment and nothing happens but the screen jumping up to the top. http://www.runningprofiles.com/membe...ll_Script.php# Why is this?? What do i need to do to fix it? PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>9lessons Applicatio Demo</title> <link href="frame.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript" src="jquery.oembed.js"></script> <script type="text/javascript"> $(function() { $('.more').live("click",function() { var ID = $(this).attr("id"); if(ID) { $("#more"+ID).html('<img src="moreajax.gif" />'); $.ajax({ type: "POST", url: "http://www.runningprofiles.com/members/shout/data/ajax_more.php", data: "lastmsg="+ ID, cache: false, success: function(html){ $("ol#updates").append(html); $("#more"+ID).remove(); // removing old more button } }); } else { $(".morebox").html('The End');// no results } return false; }); }); $(function() { $(".view_comments").click(function() { var ID = $(this).attr("id"); $.ajax({ type: "POST", url: "../viewajax.php", data: "msg_id="+ ID, cache: false, success: function(html){ $("#view_comments"+ID).prepend(html); $("#view"+ID).remove(); $("#two_comments"+ID).remove(); } }); return false; }); }); $(function() { $(".comment_button").click(function() { var element = $(this); var boxval = $("#content").val(); var dataString = 'content='+ boxval; if(boxval=='') { alert("Please Enter Some Text"); } else { $("#flash").show(); $("#flash").fadeIn(400).html('<img src="ajax.gif" align="absmiddle"> <span class="loading">Loading Update...</span>'); $.ajax({ type: "POST", url: "update_ajax.php", data: dataString, cache: false, success: function(html){ $("ol#update").prepend(html); $("ol#update li:first").slideDown("slow"); document.getElementById('content').value=''; $('#content').value=''; $('#content').focus(); $("#flash").hide(); $("#expand_url").oembed(boxval); } }); } return false; }); //comment slide $('.comment').live("click",function() { var ID = $(this).attr("id"); $(".fullbox"+ID).show(); $("#c"+ID).slideToggle(300); return false; }); //commment Submint $('.comment_submit').live("click",function() { var ID = $(this).attr("id"); var comment_content = $("#textarea"+ID).val(); var dataString = 'comment_content='+ comment_content + '&msg_id=' + ID; if(comment_content=='') { alert("Please Enter Comment Text"); } else { $.ajax({ type: "POST", url: "comment_ajax.php", data: dataString, cache: false, success: function(html){ $("#commentload"+ID).append(html); document.getElementById("textarea"+ID).value=''; $("#textarea"+ID).focus(); } }); } return false; }); // Delete Wall Update $('.delete_update').live("click",function() { var ID = $(this).attr("id"); var dataString = 'msg_id='+ ID; var parent=$("#bar"+ID); jConfirm('Are you sure you want to delete this message?', 'Confirmation Dialog', function(r) { if(r==true) { $.ajax({ type: "POST", url: "delete_comment.php", data: dataString, cache: false, success: function(html){ $("#comment"+ID).slideUp(); } }); } return false; }); return false; }); }); </script> <style type="text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; } .update_box { background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px } a { text-decoration:none; color:#d02b55; } a:hover { text-decoration:underline; color:#d02b55; } *{margin:0;padding:0;} ol.timeline {list-style:none;font-size:1.2em;}ol.timeline li{ display:none;position:relative; }ol.timeline li:first-child{border-top:1px dashed #006699;} .delete_button { float:right; margin-right:10px; width:20px; height:20px } .cdelete_button { float:right; margin-right:10px; width:20px; height:20px } .feed_link { font-style:inherit; font-family:Georgia; font-size:13px;padding:10px; float:left; width:350px } .comment { color:#0000CC; text-decoration:underline } .delete_update { font-weight:bold; } .cdelete_update { font-weight:bold; } .post_box { height:55px;border-bottom:1px dashed #006699;background-color:#F3F3F3; width:499px;padding:.7em 0 .6em 0;line-height:1.1em; } #fullbox { margin-top:6px;margin-bottom:6px; display:none; } .comment_box { display:none;margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:50px; } .comment_load { margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:30px; font-size:12px; border-bottom:solid 1px #FFFFFF; } .text_area { width:290px; font-size:12px; height:30px; } #expand_box { margin-left:90px; margin-top:5px; margin-bottom:5px; } embed { width:200px; height:150px; } *{ margin:0px; padding:0px } ol.timeline { list-style:none } ol.timeline li { position:relative; border-bottom:1px #dedede dashed; padding:8px; } .morebox { font-weight:bold; color:#333333; text-align:center; border:solid 1px #333333; padding:8px; margin-top:8px; margin-bottom:8px; -moz-border-radius: 6px; -webkit-border-radius: 6px; } .morebox a{ color:#333333; text-decoration:none} .morebox a:hover{ color:#333333; text-decoration:none} #container{margin-left:60px; width:580px } </style> </head> <body> <?php include '../../../settings.php'; ?> <div align="center"> <table cellpadding="0" cellspacing="0" width="500px"> <tr> <td> <div align="left"> <form method="post" name="form" action=""> <table cellpadding="0" cellspacing="0" width="500px"> <tr><td align="left"><div align="left"> <h3>What are you doing?</h3></div></td></tr> <tr> <td style="padding:4px; padding-left:10px;" class="update_box"> <textarea cols="30" rows="2" style="width:480px;font-size:14px; font-weight:bold" name="content" id="content" maxlength="145" ></textarea><br /> <input type="submit" value="Update" id="v" name="submit" class="comment_button"/> </td> </tr> </table> </form> </div> <div style="height:7px"></div> <div id="flash" align="left" ></div> <ol id="update" class="timeline"> </ol> <ol class="timeline" id="updates"> <div id='old_updates'> <?php $small=mysql_query("select * from messages2 order by msg_id desc LIMIT 5"); while($r=mysql_fetch_array($small)) { $id=$r['msg_id']; $msg=$r['message']; ?> <div align="left" class="post_box"> <span style="padding:10px"><?php echo $msg.'....'.$id; ?> </span> </div> <?php //Here $id is main message msg_id value. $csql=mysql_query("select * from comments where msg_id_fk='$id' order by com_id "); $array = mysql_fetch_assoc($csql); $comment_count=mysql_num_rows($csql); if($comment_count>2) { $second_count=$comment_count-2; ?> <div class="comment_ui" id="view<?php echo $id; ?>"> <a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php echo $comment_count; ?> comments</a> </div> <?php } ?> <div id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <table width="80%"> <?php $small2=mysql_query("select * from comments where msg_id_fk='$id' order by com_id limit 2 "); while($rowsmall22=mysql_fetch_array($small2)) { $c_id=$rowsmall22['com_id']; $comments=$rowsmall22['comment']; ?> <div class="comment_actual_text"> <tr> <td style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" valign="top"> <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" align="left"> <tr> <td width="5%" style="VERTICAL-ALIGN: middle; TEXT-ALIGN: center"><img style="WIDTH: 30px; HEIGHT: 30px" alt="srinivas" src="http://www.gravatar.com/avatar.php?gravatar_id=7a9e87053519e0e7a21bb69d1deb6dfe" border="1" /></td> <td style="VERTICAL-ALIGN: top; TEXT-ALIGN: left"> <strong>Jarratt</strong> <?php echo $comments; ?> <br /><span style="COLOR: #a9a9a9">10 min ago - ID = <?php echo $c_id.'...'.$id;?> </span></td> </tr> </table><br /> </td> </tr> </div> <?php } ?> </table> </div> <?php } ?> </ol> <div id="more<?php echo $id; ?>" class="morebox"> <a href="#" class="more" style='display:block;width:100%;' id="<?php echo $id; ?>">more <?php echo $id; ?></a> </div> </div> </td> </tr> </table> </div> </body> </html> if it help here is ajax_more.php PHP Code: <?php include("../../../settings.php"); if(isSet($_POST['lastmsg'])) { $lastmsg=$_POST['lastmsg']; $lastmsg=mysql_real_escape_string($lastmsg); $small=mysql_query("select * from messages2 WHERE msg_id<'$lastmsg' order by msg_id desc LIMIT 2"); while($r=mysql_fetch_array($small)) { $id=$r['msg_id']; $msg=$r['message']; ?> <div align="left" class="post_box"> <span style="padding:10px"><?php echo $msg.'....'.$id; ?> </span> </div> <?php //Here $id is main message msg_id value. $csql=mysql_query("select * from comments where msg_id_fk='$id' order by com_id "); $array = mysql_fetch_assoc($csql); $comment_count=mysql_num_rows($csql); if($comment_count>2) { $second_count=$comment_count-2; ?> <div class="comment_ui" id="view<?php echo $id; ?>"> <a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php echo $comment_count; ?> comments</a> </div> <?php } ?> <div class="comments" id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <table width="50%"> <?php $small2=mysql_query("select * from comments where msg_id_fk='$id' order by com_id limit 2 "); while($rowsmall22=mysql_fetch_array($small2)) { $c_id=$rowsmall22['com_id']; $comments=$rowsmall22['comment']; ?> <div class="comment_actual_text"> <tr> <td style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" valign="top"> <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" align="left"> <tr> <td width="5%" style="VERTICAL-ALIGN: middle; TEXT-ALIGN: center"><img style="WIDTH: 30px; HEIGHT: 30px" alt="srinivas" src="http://www.gravatar.com/avatar.php?gravatar_id=7a9e87053519e0e7a21bb69d1deb6dfe" border="1" /></td> <td style="VERTICAL-ALIGN: top; TEXT-ALIGN: left"> <strong>Jarratt</strong> <?php echo $comments; ?> <br /><span style="COLOR: #a9a9a9">10 min ago - ID = <?php echo $c_id.'...'.$id;?> </span></td> </tr> </table><br /> </td> </tr> </div> <?php } ?> </table> </div> <?php } ?> <div id="more<?php echo $id; ?>" class="morebox"> <a href="#" class="more" style='display:block;width:100%;' id="<?php echo $id; ?>">more <?php echo $id; ?></a> </div> <?php } ?> 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 <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> 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; } |