JavaScript - Eliminating One Back?
Not sure how to explain this but......
Using a meta refresh to display a thankyou page for 5 seconds after a form submit, then return to form. If user clicks back to return to main page from form, returns to thankyou page instead, and has to go back to form again, then back to main page. I can have thankyou page return to main page, but would rather return to form. This is what it should do: main page -> form -> thankyou page -> form -> main page This is what it does: main -> form -> thankyou -> form -> thankyou -> form -> main Is there any way to remove thankyou page from history? Similar Tutorialsi have the following code which i am trying to insert a 'back button' into to go back to the previous page. i can only seem to get the button to appear either at the very top or very bottom of the page, does anyone know how i can specify the location? this script is generated from easypano tourweaver - Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Virtual Tour Created By CAPITA SYMONDS</title> </head> <body leftMargin="0" topMargin="0" rightMargin="0" bottomMargin="0"> <script type="text/javascript" src="swfobject.js"></script> <div id="flashcontent"> To view virtual tour properly, Flash Player 9.0.28 or later version is needed. Please download the latest version of <a href="http://www.adobe.com/go/getflashplayer" target="_blank">Flash Player</a> and install it on your computer. </div> <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("twviewer.swf", "sotester", "1024", "768", "9.0.0", "#FFFFFF"); so.addParam("allowNetworking", "all"); so.addParam("allowScriptAccess", "always"); so.addParam("allowFullScreen", "true"); so.addParam("scale", "noscale"); //<!-%% Share Mode %%-> so.addVariable("lwImg", "resources/2_area_multipix_preloading image file.jpg"); so.addVariable("lwBgColor", "255,255,255,255"); so.addVariable("lwBarBgColor", "255,186,186,186"); so.addVariable("lwBarColor", "255,153,0,0"); so.addVariable("lwBarBounds", "-512,-384,1024,768"); so.addVariable("lwlocation", "4"); so.addVariable("lwShowLoadingPercent", "false"); so.addVariable("lwTextColor", "255,0,0,0"); so.addVariable("iniFile", "config_2_Area_Multipix.bin"); so.addVariable("progressType", "1"); so.addVariable("swfFile", "resources/2_area_multipix_1_animation for tourweaver.swf"); so.addVariable("href", location.href); so.write("flashcontent"); // ]]> </script> </body> </html> here is the button code - Code: <span onclick="javascript:history.back()" style="text-decoration:underline; color:blue; cursor:hand">Back</span> I need an html page that when visited automatically redirects the browser to return to the previous page it was on. here is the current code I have: Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script type="text/javascript"> function load() { history.go(-1) alert(""); } </script> </head> <body onload="load()"> <input type="button" value="Back" onclick="goBack()" /> </body> </html> this works in firefox but in IE you have to press ok in the alert box before it returns. I admit I am a javascript novice. Any suggestions Hi, I currently have a <div> with a <p> and have an edit button that when clicked will transform it into a textarea using jQuery's .html(). I also have a cancel button which allows the user to cancel the edit and return the textarea to the previous content, any ideas how I do this? JavaScript Code: // JavaScript Document jQuery(document).ready(function(e) { $('#edit_p').click(function(e){ $('#cancel_p').show(); $('#greeting').html("<textarea id='txt_greeting' cols='20'>" + $('#greeting p').text() + "</textarea>"); $(this).hide(); }); $('#cancel_p').click(function(e){ $('#edit_p').show(); $(this).hide(); }); }); HTML Code: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Textarea/Button Change</title> <script type="text/javascript" src="jquery-1.7.js"></script> <script type="text/javascript" src="txt_area_jquery.js"></script> <link rel="stylesheet" type="text/css" href="txt_area_style.css" /> </head> <body> <div id="greeting"><p>Hello, today is a great day!</p></div> <input type="button" name="edit_p" id="edit_p" value="Edit" /> <input type="button" name="cancel_p" id="cancel_p" value="Cancel" /> <?php ?> </body> </html> Hello there, I'm a 30yr old returning to school and I signed up for a CMIS102 class, thinking it be more explanatory as the syllabus let on. But I was wrong. While I do understand some of what the professor has been teaching us, like modular programming and IfElse statements, I can't wrap my head around things like While Loops. My professor has saddled us with a couple assignments, requiring us to write in pseudocode and I was wondering if anyone could explain what he wants from this assignment or even help me with it, that maybe I can finally have a grasp of it, and will know what I'm doing on the final. ~Tia P.S. I've posted the assignment question below: I need to write a pseudo-codepseudocode for the following question but don't know how: Write a program to read a list of exam scores (in the range 0 to 100) and to output the total number of grades and the number of grades in each letter=grade category. The end input is indicated by a negative score as a sentinel value. (The negative value is used only to end the loop, so do not use it in the calculations. Example: 88 93 55 77 100 -1 (The output would be) Total number of grades = 5 Number of A's =2 Number of B's = 1 Number of C's =1 Number of D's = 0 Number of F's =1 Must prompt user to run again I am making a simple puzzle game on Android using Phonegap, that is HTML5, CSS3 and JavaScript. When a user fills an answer on a page, if the answer is correct, it will go to another page. However, once the user goes to the next page, he/she CANNOT return back to the previous page. I do not want the user to return back, else he/she will have to fill the answer again to go to the next page, so it's not good. Thank this function seems to be working fine in all browser but of course. I'm still a noob at JavaScript and well things like this just doesn't make sense. when I go to alert this function in IE I get undefined. But other browser gives me a value. What am I doing wrong with this function? Code: function ext() { var img = document.getElementById('photoSmall'); img = img.src; if (typeof img == 'string' && img != 'undefined') { var typeis = img.substr(-4); if (typeis == '.png' || '.jpg' || '.gif') { return typeis; } } } Thanks Jon W I am not sure if this has been posted before but I need help with this. When a user clicks on the back button I need them to be directed to the previous page and still have their original selections and not the defaults. Here is the rest of code on the back button. At the moment this is not working. <input id=STDBUTSHORT type="button" value="Back" onClick="history.back();">') Thanks in advance. Hello kind folk of codingforums.com! I am pretty new to JS and have been racking my brain all week to find a solution for this. I have a javascript fading slideshow but it has no back or next button. I'm not sure if i need to add another function or go about it a different way. Here is the code if anyone can help. Thanks in advance!!! <script type="text/javascript"> var slidespeed=5800 var slideimages=new Array("my_images/SBDCslide.gif","my_images/americanbuilding.gif","my_images/emerald.gif", "my_images/nautical.gif", "my_images/rent.gif","my_images/allyn.gif","my_images/SBDCslide.gif","my_images/signs.gif","my_images/cobalt.gif","my_images/test.gif","my_images/federal.gif") var slidelinks=new Array("#" ,"american.asp","emerald.asp","nautical.asp") var whichlink=0 var whichimage=0 var imgobj, filtersupport, blenddelay var imageholder=new Array() for (i=0;i<slideimages.length;i++){ //preload images imageholder[i]=new Image() imageholder[i].src=slideimages[i] } function gotoshow(){ window.location=slidelinks[whichlink] } function slideit(){ if (filtersupport) imgobj.filters[0].apply() imgobj.src=imageholder[whichimage].src if (filtersupport) imgobj.filters[0].play() whichlink=whichimage whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0 setTimeout("slideit()", slidespeed+blenddelay) } window.onload=function(){ imgobj=document.getElementById("slideshow") //access img obj filtersupport=imgobj.filters //check for support for filters blenddelay=(filtersupport)? imgobj.filters[0].duration*1000 : 0 slideit() } </script> overview: from my javascript, i call a function in the php block, that function successfully retrieves a value from the database, but when i pass that retrieved value back to the calling function....all is lost somehow. when i test this code by itself, it works fine and gets the correct number. <?php mysql_select_db($database_connFtH, $connFtH); $result = mysql_query("SELECT status_index FROM cpqc_status ORDER BY row_id DESC"); $row_result = mysql_fetch_assoc($result); $index = $row_result['status_index']; echo $row_result['status_index']; echo $index; echo "the value of index is ".$index; ?> however, when i set this same code up as a function to be called upon globally, and to return the value of $index, it all just seems to "not work". <?php function runStatus() { mysql_select_db($database_connFtH, $connFtH); $result = mysql_query("SELECT status_index FROM cpqc_status ORDER BY row_id DESC"); $row_result = mysql_fetch_assoc($result); $index = $row_result['status_index']; return ($index); } //end function runStatus() ?> the calling function, with an alert box to check if the value of $index was passed down accurately <script type="text/javascript"> var x = runStatus(); alert(x); </script> all i want to do is call a server-script function that deals with the database and gets me a value out of the database, and pass that value back to the calling function. can't figure out what is wrong. the "return($index)" should send back the value of $index. the call to that function should receive back a value and assign it to "x". and the alert(x) should spit it out with no problem. but......something is wrong and it won't work. any ideas what is wrong? it is my understanding that a function inside the php determants can be called upon from anywhere and that function can return a value.(?) argh!! i think i know why Einstein's hair was always so messy!! thanks, Paul Williams weather today in Kalispell, MT: 7 deg this morning, got a little snow last night, only about 6 or 8 inches, not much. maybe more later. I need a back to top link on the bottom of my page that stays there all the time while people are scrolling.. is this possible? is this close to what i'm looking for? http://javascript.internet.com/page-...ting-link.html i've seen it on some other sites but I can't find any to reference now... I'm totally new to this! thanks for your help! -B Yeah, did that title confuse you? :P I realize there is a problem with forms in IE7 and 8, where when a form is submitted, and you click the Back button or use history.go(-1), dynamic elements are not properly shown with their previous values. I can save the forms data to cookies for future use, but when I try to go Back, the page isn't actually reloaded, so the script won't load the cookies. How can I force a reload of the previous page upon going Back? Sorry if this is the wrong place for this question, but... I'm having an issue with the difference in behavior between the IE and FF back buttons. I'm using jQuery to create collapsable div regions which contain text boxes on a search form. After submit, if the use clicks the back button in FF, the region(s) the user had previously expanded, show as expanded. Also, there search term is still present. In IE, when clicking the back button, all regions are collapsed, in there original loaded state, but the search term is still saved. I put the following code at the top of the page: onload=function(){ alert('Onload!'); } When clicking the back button in FF, nothing happens. For IE, the alert pops up. This tells me that IE reloads the page (but somehow still saves some things, like the search text). My question is, is there a way to keep IE from reloading when the use clicks 'back'? I will be creating my own 'edit' back button for users to get around this, but I also would like to prevent this from confusing users and causing undesired results. Any help would be greatly appreciated. Please follow these steps in my jsfiddle: 1. click on the (open grid) link and select option "13", buttons A to N would appear 2. click on the select all answers button, all buttons A to N would turn green. 3. Now click on the open grid again and select option "5". As you can see all the buttons from A to 5 are now selected (Have all turned green). 4. Now go back to grid and choose option 13. As you can see all buttons A to N would be selected. I don't want this to happen. What should happen is that the 5 buttons selected before the option change should remain selected and the other 8 buttons should go back being unselected, but I do not know how to do this. I tried including this in the selectAll() function but it did not work: Code: $('.answerBtns:hidden').removeClass('answerBtnsOn').addClass('answerBtnsOff'); Does anyone have any ideas? Code is in jsfiddle, click [here][1] Thank You [1]: http://jsfiddle.net/C7vcQ/5/ Hello everyone, I am totally new to javascript, I have a web form I designed using coffeecup, the form is very long about 4 pages long and it is all in one long scroll down the page, I was wondering if I can add page breaks and at the bottom of each categoty inserting a button for next and back whilst hiding the rest of the categories until next is clicked etc. until you reach submit. Please help in anyway you can?\ Yhanks K How you handle back button scenario in firefox browser. The problem is when i click browser back button , the javascript on load is not executed and page is rendered from cache. It works in IE.. Hi, I have the following problem: When I use this script it pops up both if a user tries to close the window and also if he presses the back button. Please tell how to show another window or do another action when the back button is pressed? I know it is possible although a lot of people say it's not. Code: <script type="text/javascript" type="text/javascript"> window.onbeforeunload = confirmExit; function confirmExit() { return "blabla"; } </script> Hi all, I'm quite new to Javascript, and I'm stuck with a problem here. I have a website, I won't go in to detail, but it generates some javascript code for the user. Well, that's the idea. The user puts this javascript on his or her website. Now everytime the page with that javascript is loaded, a page on my server is called, and is supposed to display something on the place of the javascript of that website. I however have not the slightest clue how to do this. The script on my server has to get some values from a database (I'll be doing this with php). Therefore are some variables needed, like ID's. Those are put in the javascript at the website of that person. (I know they could just change it, but that'd only disadvantage them) And example of the code the person with the website would get is this: (This was also generated on user basis somewhere, which does about the same thing) Code: <script language="javascript" type="text/javascript" charset="utf-8"> var border = '#000000'; id = 1337; </script> <script language="JavaScript" type="text/javascript" src="http://somesite.com/scriptname.php"> </script> If you don't understand what I'm trying to do here, please ask, because I might not've explained it clear enough. Thanks, lordstyx. [edit] Someone said to look in the direction of XMLHttpRequest. I don't really know what that is, but I'll try and find a bit more info about it. Help! I am using a shopping cart solution that my clients had set up. The back end makes it close to impossible to upload my own files for use on the page IE .xml files, or any files other than images. The biggest problem is that the links they provide that lead to my product categories are text links, and they are heanous looking. I would like to spruce it up, throw the Product Category Links into a categorized drop down menu across the top. I am new to javascript and php and xhtml and coding in general. I NEED SOME HELP. Here is a copy of the header code where i assume i would place the drop down menu. <code> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title><ss:value source="$page.title"/></title> <link rel="icon" href="$store.images['favicon.ico']" type="image/x-icon"> <link rel="shortcut icon" href="$store.images['favicon.ico']" type="image/x-icon"> <ss:if test="$page.hasMetaDescription()"><META NAME="description" CONTENT="$page.meta.description"></ss:if> <ss:if test="$page.hasMetaKeywords()"><META NAME="keywords" CONTENT="$page.meta.keywords"></ss:if> <style type="text/css"> <!-- /* Style Sheet */ body { margin : 0px 0px 0px 0px; background-color:<ss:value source=$storeVersion.colorScheme.background/>; } .nav A:link {text-decoration:color:#000000} .nav A:visited {text-decoration:underline;color:#000000} .nav A:hover {text-decoration:none;color:#000000} .nav A:active {text-decoration:underline;color:#000000} .nav2 A:link {text-decoration:color:#000000} .nav2 A:visited {text-decoration:underline;color:#000000} .nav2 A:hover {text-decoration:none;color:#000000} .nav2 A:active {text-decoration:underline;color:#000000} .title {font-size:10pt;font-weight:bold;font-family:<ss:value source=$font.paragraph/> ;color:#000000;background-color:#FFCCCC;text-align:left;} .content {font-family:<ss:value source=$font.paragraph.face/> ;padding:8px 8px 8px 8px;text-align:left;} .nav {font-size:9pt;font-family:<ss:value source=$font.paragraph.face/> ;color:#000000;background-color:#FFCCCC;} .nav2 {padding:5px 5px 5px 5px;font-size:9pt;font-family:<ss:value source=$font.paragraph.face/> ;color:#000000;} .footer {font-size:9pt;font-family:<ss:value source=$font.paragraph.face/> ;color:<ss:value source=$font.paragraph.color/>;text-align:center;} --> </style> </head> <body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table border="0" cellspacing="0" cellpadding="0" width="100%" > <tr> <td class="nav" valign="middle"> <font class="title"></font> <ss:if test="$storeVersion.storeLogoName"> <ss:link source="$storeVersion.homePage"><ss:image border="0" alt="" source="$storeVersion.storeLogo"/></ss:link> </ss:if> <ss:value source="$store.name"/> <font size="+0"></font></td> <td class="nav" valign="bottom" align="right"> <ss:link source="$storeVersion.catalog">Advanced Search</ss:link> | <ss:link source="$storeVersion.cart">View Cart</ss:link> | <ss:link source="$storeVersion.checkout">Checkout</ss:link> </td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" width="75%" > <tr> <td colspan="3"><ss:image border="0" alt="" width="1" height="1" source="$storeVersion.images['pixel.gif']"/></td> </tr> <tr> <td class="nav2" bgcolor="#ccff99" colspan="2"> <ss:if test="$storeVersion.templateExists('About Us')"> <ss:link source="$storeVersion.aboutUs">About Us</ss:link> </ss:if> <ss:if test="$storeVersion.templateExists('Customer Service')"> | <ss:link source="$storeVersion.customerService">Service</ss:link> </ss:if> <ss:if test="$storeVersion.templateExists('Store Policy')"> | <ss:link source="$storeVersion.storePolicies">Policies</ss:link> </ss:if> </td> <td class="nav2" bgcolor="#ccff99" align="right"> <ss:if test="$storeVersion.templateExists('Home Page')"> <ss:link source="$storeVersion.homePage">Home</ss:link> </ss:if> </td> </tr> <tr valign="top"> <td class="nav2" rowspan="2" width="140" background="$storeVersion.images['yellow.gif']"><ss:image border="0" alt="" width="20" height="14" source="$storeVersion.images['greenstream.gif']"/> <ss:image border="0" alt="" width="20" height="23" source="$storeVersion.images['pinkstream.gif']"/> <ss:image border="0" alt="" width="20" height="15" source="$storeVersion.images['bluestream.gif']"/> <form method="post" action="$storeVersion.searchResults"> Search <ss:button source="$storeVersion.images['go.gif']" alt="GO" border="0"/> <br /><input size="12" name="keyword" /> </form> <font size="6"><font face="Comic Sans MS"><strong>Products</strong><br /></font></font> <ss:foreach item="category" within="$catalog.categoryList()"> <ss:sortby item="categorypriority" direction="asc"/> <ss:if test="$category.treeLevel == '1'"> <ss:link source="$category"/><br /><ss:else /><span style="POSITION: relative; LEFT: 8px"><ss:link source="$category"/><br /></span> </ss:if> <font face="Comic Sans MS"></font> </ss:foreach> <p> </p> <ss:if test="$store.isFeatureEnabled('ShowAffiliateLink')"> <ss:link source="$storeVersion.affiliate">Become an Affiliate</ss:link><br /> </ss:if> <ss:if test="$store.isFeatureEnabled('ShowMembersOnlyLink')"> <ss:link source="$storeVersion.searchMembersOnly">Members Only Catalog</ss:link><br /> </ss:if> <ss:if test="$store.isFeatureEnabled('ShowStoreSubscriptionLink')"> <ss:link source="$storeVersion.subscribe">Become a Member</ss:link><br /> </ss:if> <ss:image border="0" alt="" width="140" height="300" source="$storeVersion.images['pixel.gif']"/> </td> <td class="content" width="100%"><br /><!-- header ends --> </code> That's the header code the dude with customer service told me that the sites werent generated in html, but that can't be entirely true can it? The guy was a duesche. So I guess what i really need to know is what do i need to move the <code> <ss:foreach item="category" within="$catalog.categoryList()"> <ss:sortby item="categorypriority" direction="asc"/> <ss:if test="$category.treeLevel == '1'"> <ss:link source="$category"/><br /><ss:else /><span style="POSITION: relative; LEFT: 8px"><ss:link source="$category"/><br /></span> </ss:if> <font face="Comic Sans MS"></font> </ss:foreach> <code/> To make that into an overhead drop down menu? I am a script kiddie noob, you are the greatest, you are smart and i am not, you are atrractive and i am ugly lol Thanks very much to who ever can possible help me! Hello there, This seems to be a bit of a sore topic on the forums but at least I think I have good reason for wanting to do it - I've written a script that displays tooltips when your mouse hovers over a link - all this is fine, but when I click on the link and move to another page, then click the back button on the browser to go back, the tooltip for the link I clicked is still visible! It'd be great if there was a way of detecting the button had been pressed so that I can hide it... p.s. I tried onclick = "tooltips.hideToolTip(4); return true;" for the links but no joy... Many thanks Edd |