JavaScript - Help Making Entry Confirmation Page
Hi, I am trying to make an entry confirmation form. This is going to be used as a disclaimer for my website. How can I make this to where it only shows on the main page and not every page a user goes to on my website?
<script> var enter=confirm("examples insert text") if (!enter) window.location="http://www.google.com" </script> Similar TutorialsHello all, Im new to the board, Have a question i cant figure out. This board seems very helpful, so here goes. Im trying to grab certain variables like orderID & Subtotal variables that are posted to the confirmation page. The reason im grabbing these is for a confirmation pixel that is displayed for commission junction. When some clicks on their link, then completes an order, their tracking pixel fires grabs these variables and that way they can track the order confirmaton. The problem is they dont see the tracking pixel firing and its not grabbing the variables. I dont know what to do. Here is the code. maybe someone here can help me?? This is the code that shows on the confirmation page. Im assuming this is where im suppose to grab the variables. Code: //<![CDATA[ var SecureCartOrders = [ {"orderID":154983165,"name":"Max Test","company":null,"email1":"max@maxtest.com","address1":"123 main st","address2":null,"city":"miami","state":"Florida","zip":"33845","country":"United States","fax":null,"phone":"5611112222","secondaryphone":null,"cardtype":"","shipname":"Max Test","shipCompany":null,"shipAddress1":"123 main st","shipAddress2":null,"shipCity":"west palm beach","shipState":"Florida","shipZip":"33405","shipCountry":"United States","status":"Accepted","product":["oil product"],"sku":["FC1246"],"quantity":[1],"price":[0.00],"option":[[]],"productattributes":[{}],"plist":"3598071","Total":0.00,"shippingMethod":"Free Shipping","shippingAmount":0,"grandTotal":0.00,"adtrack":0} ]; //]]> This is the javascript code that im using to grab those variables. The variables that i need are orderID & Total Code: <script type='text/javascript'> var orderId = SecureCartOrders[0].orderID; var subTotal = SecureCartOrders[0].Total; var url ='https://www.emjcd.com/u?CID=111111&TYPE=343000&CURRENCY=USD&METHOD=IMG'; url += '&OID=' + orderId; url += '&AMOUNT=' +subTotal; document.write('<img width=\'20\' height=\'1\' src=\' + url + \'\'>'); </script> I have no idea what else i can do. This is a system hosted confirmation page from a shoppingcart software called, 1shoppingcart.com Hi, I'm looking for help, please. I am trying to setup a donation form for a friend, where someone can click radio buttons for set donation amounts, or click the "other" radio buttons and enter a different amount. The donation amount is then passed over to a secure credit card entry page, hosted by a 3rd party merchant. I can set up all the pre-defined radio buttons to correctly pass on the donation amount to the credit card page, but I cannot figure out how to work the "other" radio button amount. Any help would be very much appreciated! Thanks! Hello everyone! I'm a complete newb to Javascript. I'm currently working on something that I am quite stuck with. Basically, I have a hexagon of pictures displayed on an HTML page. I need these pictures to rotate counter clockwise every 3000 ms. I have the code below and have made some adjustments, but how would I modify the functions to get the pictures to move? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Javascript Fun!</title> <script type="text/javascript"> <!-- var pixArray = Array(6); function shiftPix(element, count, index) { var pi = 3.1415926535; y = 300 + 150 * Math.cos(2 * pi * (count + index)/6); x = 300 + 150 * Math.sin(2 * pi * (count + index)/6); element.style.left = x + "px"; element.style.top = y + "px"; } function display() { for (j = 0; j < 6 ; j++) { shiftPix(pixArray[j], counter, j); } setTimeout("display()",3000); } // --> </script> </head> <body onload="display();"> <div id="Picture1" style="position:absolute;left:300px;top:450px"> <img src="picture1.jpg" width="90" height="120" /> </div> <div id="Picture2" style="position:absolute;left:430px;top:375px"> <img src="picture2.jpg" width="90" height="120" /> </div> <div id="Picture3" style="position:absolute;left:430px;top:225px"> <img src="picture3.jpg" width="90" height="120" /> </div> <div id="Picture4" style="position:absolute;left:300px;top:150px"> <img src="picture4.jpg" width="90" height="120" /> </div> <div id="Picture5" style="position:absolute;left:170px;top:225px"> <img src="picture5.jpg" width="90" height="120" /> </div> <div id="Picture6" style="position:absolute;left:170px;top:375px"> <img src="picture6.jpg" width="90" height="120" /> </div> <script type="text/javascript"> <!-- var counter = 0; pixArray[0] = document.getElementById("Picture1"); pixArray[1] = document.getElementById("Picture2"); pixArray[2] = document.getElementById("Picture3"); pixArray[3] = document.getElementById("Picture4"); pixArray[4] = document.getElementById("Picture5"); pixArray[5] = document.getElementById("Picture6"); display(); // --> </script> </body> </html> Thanks in advance!! (Please note, although I've included jQuery code here, this is a general JavaScript question.) At http://jquery14.com/day-05 (code at http://pastie.org/783420) I saw this code: Code: // all <a href="#anchor"> smoothscroll to those elements $("a[href^=#][href!=#]").live('click',function(e){ $('html,body').animate({'scrollTop': $($(this).attr('href')).offset().top+'px'}); e.preventDefault(); }); I'm using this idea of smoothscrolling to destination anchors in a page I'm developing, but is it a bad idea from an accessibility point of view? I don't have a screen reader (couldn't get Fire Vox to work), but I am assuming that when you follow a link to a destination anchor in the same document, a screen reader begins reading from the destination anchor. But this code cancels the default action of the link being followed. The page scrolls, but I assume this means nothing to a screen reader. If my assumptions are correct, the links concerned are broken for screen reader users. (I suppose none of this matters if screen readers turn off JavaScript, but do they?) A related question: From what I can tell, when you follow a link to an anchor somewhere on the same page, the page is entirely reloaded. Does this happen in every browser? Thanks for any help Hey there everyone. I've got a form which has a couple of inputs. The 1st is just a text input and the 2nd a textarea. I have it so that when someone types into the 1st input some javascript causes a div elsewhere on the page to update with whatever's being typed. html: Code: <div class="input text required"> <label for="CampaignTitle">Title</label> <input name="data[Campaign][title]" type="text" maxlength="76" id="CampaignTitle" /> </div> Javascript: Code: $('#CampaignTitle').bind("onpropertychange input", function() { $('#titleBar').text(this.value); }); That works fine. But using the above I tried to create a similar effect for the textarea but it doesn't work: html: Code: <div class="input textarea"> <label for="CampaignStory">Story</label> <textarea name="data[Campaign][story]" class="ckeditor" cols="30" rows="6" id="CampaignStory" ></textarea> </div> javascript: Code: $('#CampaignStory').bind("onpropertychange input", function() { $('#story').text(this.value); }); How can I make it work thanks I have an action in PHP where, when a user clicks the delete button i want a confirmation box. How does a confirmation box work with a PHP function. Here is the function. Code: <a href="/order/delete/id/<?php echo $o->id?>"><img src="/gfx/trashicon.gif" /></a> Any help would be appreciated! Hello I have an adult website and I want an "adult message" to be display when people go to my website, something like this: http://www.latincaramelito.zoomshare.com/ i already tried some codes that i found here but they dont seem to work, the codes a first one: <script> if (!confirm("Do you want to enter this site?")) window.location=history.go(-1) </script> Second one: <html> <head> <script type="text/javascript"> var stay=confirm("The following site contains appalling material suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit immediately!") if (!stay) window.location="http://www.yahoo.com" </script> </head> <body> Appalling material here </body> </html> help me plz, thank you Hi Everyone, Has anyone noticed the twitter confirmation box (when you hit save in Settings, the page refreshes and a white confitmation box appears along the top of the screen and disappears again in a few seconds)? Does anyone know how to go about implementing this? My JS skills would not be the best. I wonder is there a jquery plugin that I could use or similar? Thanks in advance, Brian Would greatly appreciate any help with this. Have made a contact form for a website that uses javascript to validate it then once validated prompts the user if the details are correct. Currently its working in chrome and ie but not in firefox. Code is in post #3.
Ok I know there are a few other posts about this but I can't find one similar to my problem. The confirmation box pops up, but cancel does nothing. it is for deletion of a movie off a server for class, but if you hit cancel it deletes the entry anyway. here is my code: Code: <script type="text/javascript"> function show_confirm() { var r=confirm("Are you sure you want to delete?"); if (r==true) { window.location="movie_delete.cfm?FilmID=#FilmID#"; } } </script> [<a href="movie_delete.cfm?FilmID=#FilmID#" onclick="show_confirm()">Delete</a>] notice anything wrong? Hello, How can this be made to return confirmation? <form id="score_form" method="post" action="addscore.php"><input id="score" name="score" value="" type="hidden"><img id="collect" style="cursorointer;height: 37px; width: 100px; margin-top: 13px;" src="./collectlive.gif" onclick="collect_points();"></form> Letsay the confirmation window would say"ARE YOU SURE" Hi all, I want to have a javascript popup box so that when a hyperlink is clicked, a user is asked if they are sure they want to click this link, if they select ok then the page loads, if they click canel then nothing happens, so i have this code below: Code: <script type="text/javascript"> function confirmSubmit() { var agree=confirm("Are you sure you wish to click this link?"); if (agree) return true ; else return false ; } </script> Code: <a onclick="return confirmSubmit()" href="page.html">Page</a> However when a user clicks cancel the link still loads, can anyone see where I am going wrong? any help will be appreciated I have created a button with a window.confirm() method but when I click on it in firefox the dialog box does not appear. It does however appear in all the other browsers
i hava e java script fr confrmation of record deletion on server side in asp.net function deleteCheck() { if (document.getElementById('H_ctrl').value!="") { alert(document.getElementById('H_ctrl').value) var delconfirm = confirm('Are you sure ? You want to delete ' + document.getElementById('H_ctrl').value +' Details ?') if (delconfirm==true) { var delconfirmAgain = confirm('The Record ' + document.getElementById('H_ctrl').value +' will be deleted permanently. Are you sure? ') if(delconfirmAgain==true) { return true } else { return false } } else { return false } } } BTNDELETE.Attributes("onclick") = "javascript:return deleteCheck();" in the button event i have a query for redord deletion i need to delete the records if u use the return keyword the record doesnot get deleted but if i remove the return keyowrd the record gets deleted even if CANCEL is clicked Hi, My code below shows a list of Qualifications and a Delete (Remove) button I would like to show the Qualification name not the setting_id my problem is that I am not passing the Qualification name through in the form... Can someone please help me? JavaScript Code: function confirmqualification() { var SettingID = document.getElementById('setting_id').value; var answer = confirm("Delete entry "+SettingID+" ?") if (answer){ alert("Qualification Deleted") window.location = "delete_qualification.php?&setting_id="+SettingID; } else{ alert("No action taken") } } html Code: <fieldset> <legend>Qualifications </legend> <select name="setting_id" id="setting_id" size="7" style="width:100%;"> <?php while($row1 = mysql_fetch_array($result)) { echo '<option value="'.$row1['setting_id'].'">'.$row1['qualification'].'</option>'; } ?> </select> <input type="button" name="remove" id="remove" value="Remove" onClick="javascript:confirmqualification()" /> </fieldset> Hi. I have a question about java script code. I'm creating a website with frames. Within the main page frame, there are tables in the main content page. When I created the website, it fit perfectly in the browser window of my smaller laptop. I just checked it out on my old G5 and the images/pages are too big and either cut off or scroll bars appear (which is not what I want) So I wanted to know what code I put in my files and where to put it? Also, what pages does it need to be in? the main frame index page? the specific pages that fit within the frames? some are images that load in the frames? would i need to create an .html for those and then have the .jpg load so that it can be resized? I need the main page to be resized to fit the browser as well as the pages in the frames to fit. Can you help? Thanks I have a js confirmation function: PHP Code: function r_u_sure(message, url){ if(confirm(message)) location.href = url; } if I were calling this function with a regular href, I would use the following: PHP Code: <a HREF="javascript:r_u_sure('Are Sure You want to Delete or Modify Car Information?!','www.somewhere.com)"><a/> however my html link which begins the deletion process of a records opens a popup box that performs. the link is the following: PHP Code: <a onmouseover='this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick="document.getElementById('PopUp10').style.display = 'block' \"><span><img border='0' src='../images/editcar_info.png' width='40' height='40' title='Delete or Modify Car'></span></a> Any thoughts on how can conbine both so that onclick of the link, first, the confirm box appears, if "ok" is selected, the pop up box will open, else the dialogue box closes and nothing happens. Mossa-- Hi! Trying to get a delete confirm dialog box to open when you click on the button. Here's what I have in the body... @if (Model.Layer.Id > 0){ <div style="float: left; padding-left: 14px;"> @using (Html.BeginForm("Delete", "Layer", new { layerId = Model.Layer.Id, subAccountId = Model.SubAccount.Id })){ <input type="image" src="/Portal/Content/images/admin-delete-off-btn.png" onmouseover="this.src='/Portal/Content/images/admin-delete-on-btn.png'" onmouseout="this.src='/Portal/Content/images/admin-delete-off-btn.png'" title="Delete button" value="Delete" alt="Delete" /> } </div> } I can't seem to figure out the script to make this work. Can anyone help? What I had was <script type="text/javascript"> function confirmDeleteSelected(id) { jQuery("#dialog-confirmDelete").dialog({ closeOnEscape: false, resizable: false, width: 250, modal: false, zIndex: 5000, buttons: { "Yes": function () { doDeleteSelected(id); jQuery(this).dialog("close"); jQuery(this).dialog("destroy"); }, "No": function () { jQuery(this).dialog("close"); jQuery(this).dialog("destroy"); } } //end Buttons }); } </script> Thanks Phil can anyone help me change this script to add confirmation of finishing the exam when pressing submit button and avoiding that when time is out....and how could i save radio button checked even if page being refreshed it stays checked....thanks in advance. this is the code.... Code: <?php if($_POST['submit']) { print_r($_POST); $aqeel= $_POST['q']; print "a ".$aqeel[2]; exit(0); } ?> <?php //Function to generate/fetch the exam //Example output of the function: $examQuestions = " <label for='q1'>What is your name?</label><input type='text' name='q[1]' id='q1'><br /> Are you:<label for='q2a'>Male</label><input type='radio' name='q[2]' id='q2a' value='male'> or <label for='q2b'>Female</label><input type='radio' name='q[2]' id='q2b' value='female'><br /><input type='text' name='c'> "; //Set a variable in the format: 'h, m, s' for use as the timer paramiters //Sample: $timerLength = '0, 0, 10'; //0 hours, 0 minutes, 10 seconds ?> <html> <head> <script language='javascript' type='text/javascript'> function timerShow(hours, minutes, seconds, init) { if(init === true) { setTimeout("timerTick(" + (hours * 360 + minutes * 60 + seconds) + ")", 1000); } if(hours > 0) { time_left = hours + " hr:" + minutes + " min:" + seconds + " sec"; } else { if(minutes > 0) { time_left = minutes + " min:" + seconds + " sec"; } else { if(seconds > 0) { time_left = seconds + " sec"; } else { document.getElementById("submit").click(); } } } document.getElementById("timer").innerHTML = "Time Remaining: <b style='font-size: 14pt; color:red;'>" + time_left + "</b>"; } function timerTick(seconds) { seconds -= 1; if(seconds > 0) { setTimeout("timerTick(" + seconds + ")", 1000); } hours = (seconds - (seconds % 360)) / 360; seconds -= hours * 360; minutes = (seconds - (seconds % 60)) / 60; seconds -= minutes * 60; timerShow(hours, minutes, seconds, false); } </script> </head> <body> <div> This exam consists of <b><?php echo $num_q; ?></b> questions.<br /><br /> You have <b></b> minutes to complete this exam.<br /><br /> <input type='button' onclick='this.parentNode.style.display = "none"; document.getElementById("exam").style.display = ""; timerShow(<?php echo $timerLength; ?>, true);' value='Start'> </div> <form id='exam' method='post' style='display: none;'> <div id='timer'></div> <?php //output the exam here echo $examQuestions; ?> <input type='submit' value='Finish' name='submit' id='submit'> </form> </body> </html> |