JavaScript - Jump Menu With History
I am using a Jump Menu:
Code: function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function MM_findObj(n, d) { //v3.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; } function MM_jumpMenuGo(selName,targ,restore){ //v3.0 var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore); } Code: <form name="FrontPage_Form1" language="JavaScript" onsubmit="return FrontPage_Form1_Validator(this)"> <!--webbot bot="Validation" b-disallow-first-item="TRUE" --><select name="menu" class="TextArea" onchange="MM_jumpMenu('self',this,0)"> <option value="javascript:myVoid()" selected>Choose One </option> <option value="1.html">One</option> <option value="2.html">Two</option> </select> </form> Is there some way to make such a jump menu observe the history, so that going back will go back to the page containing the form? Similar TutorialsHi all, I'm having problems with a javascript jump menu that uses two select form elements, where the first one enables the second one if the right option is picked. I've not much knowledge of javascript so I've basically combined two separate functions, but at the moment only the second menu redirects the user - I need the first menu to do this as well if the second option is selected. Any ideas?! Here's the code - many thanks in advance if you can help: Code: <html> <head> <script type="text/javascript"> function chooseSelect(selectOption) { document.getElementById('shape').disabled = (selectOption!=1); } function jumpMenu(select) { var i = select.selectedIndex; var selection = select.options[i].value; var url; if (i === 0) { alert("Please select an option"); } else { url = selection; location.href = url; } } </script> </head> <body> <form action="" method="get"> <select name="color" id="color" onChange="chooseSelect(this.value);"> <option value="">- Choose Color -</option> <option value="red.html">Red</option> <option value="1">Shape</option> </select><br /> <select name="shape" id="shape" disabled="disabled"> <option value="">- Choose Shape-</option> <option value="square.html">Square</option> <option value="circle.html">Circle</option> <option value="rectangle.html">Rectangle</option> </select><br /> <br /> <input type="button" value="GO" onclick="jumpMenu(this.form.shape);"> </form> </body> </html> Hi all, first post and a bit of a newb, so please be gentle I have a file that generates web galleries in Adobe Lightroom. They are generated depending on which files are selected and the metadata in those files. Basically it is a series of pages of thumbnails called index.html index_1.html index_2.html etc. Then a set of pages for each individual image. An example can be seen he http://68.169.32.107/jonrouston/clients/su-dathan/ (the page navigation links are not great, but I have addressed that, they're at the bottom >> ) Currently if a user clicks on a photo there is a 'return to thumbnails button at the top, but this always takes them to /index.html So the user could be at a picture after browsing to /index_39.html and still get returned to /index Is there any way I can use history.go to find the last instance of index.html Or index_x.html (where x is any number) and take them back to that instead? Thanks for any help Jon Overview: Order entry project. I am using an iFrame to pull external forms that I can not change. Once our employee enters in the information and submits I would like to redirect the existing window to a new page. I've tried many variations of: Code: <script type='text/javascript'> function iHistory() { var hist=history.length; if (hist>1) { parent.window.location = "orderentry.php"; } } </script> Since I have no control of the external form I have been using OnLoad() in the iFrame tag to call iHistory(). The script works great unless the browser history is >1 If possible, I would like to also setup like a 5 or 10 second delay so the employee can see the framed confirmation page before redirect. So the function needs to check current history.length, when that changes delay 5-10 seconds and redirect parent window to orderentry.php I know that Javascript cannot look at the URLs in the browser's history object. I am not concerned with the content. I have a page that is a serious problem when user's hit the BACK button and get to it because it causes a ping-pong affect of going back, and then loading the next page again (and again and again) each time the user hits back. Is there any way to know if the page being displayed is not the last page in the history? If I can see that it is not the last page then I can send the user to the correct page instead of just pushing them forward. THANKS! Hiya was wondering if someone can help me with this: basically i'm trying to create a Back button for a report page. the first report page is a listing of dates... if i click on a date... it will open up a page with detail. I want to put the history.go on the page with detail to go back to the date listing page. obviously the page with details has page numbers. i already added a counter for clicking on the [previous] or [next]. i'm thinking of just using that click++ value and put the value on the var within history.go(var) Code: var clickCount = 1; function addcount() { a = clickCount++; return a; alert(a); } <a href="javascript:history.go( dunno what to put here )">Back</a> <a href="abc" onclick="addcount()">Previous</a> <a href="def" onclick="addcount()">Next</a> possible? or is there a better way to do this? no direct url won't work. Hello all is there any way to get browse history list ? with java script ? Hi all, I have a frame structure (three frames) where the top one is my flash navigation. The navigation itself is quite complex so I have given up on the idea of creating a back button code to control the flash. All I want to do now is to refresh the flash page when browser's back button is pressed. What I would like to do is to set a variable of the previous page I just have been so when I hit browser's back button I know if this page is the same as the variable. In each individual page i would set the varaible to be the previous page. Here are few things I have tried so far and none of them seems to work (even online!) (sections is the name of the main frame) old_page = parent.sections.history.previous; old_page =document.referrer; I tried both of them at the beginning of each page. then used onUnload command in the body tag to call a function on another frame where I have the comparison: function check_history(old_page){ if (old_page == parent.sections.location){ alert(" refresh flash"); } If I use referrer, the value is null (empty) or if I use history the variable is undefined. Has anyone come accross with anything similar? Thank you very much for your help. 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. I currently use this type of code on my "Processing" page: Code: <META content="2; url=../" http-equiv="refresh"> I am wondering if its possible to use like JavaScript history to go back? Code: <SCRIPT type="text/javascript"> setTimeout(2000) { history.back(); } </SCRIPT> The above is a bit of a guess. Can something be done like that? Hi,
I have a form in my site.when the form is submit successfully it's go to another page, which shows "submission is success".
and that page has a link to go back to a page which is viewing previously(before to form)
this is the code for it Code: <a href="javascript:history.go(-2)">Go back to previous</a> I want to know, how to go to previous page by automatically ??? this should be happen after 10 seconds! please help me.... 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 am using back button with javascript:history.back(); on it but the page I want to go back have anchor link smth like: http://example.com/index.php#anchor_link How do I go back ? I've tried javascript.history.go(-1); a I have a stupid problem... Page 1 and Page 2 have a link to Page 3 Page 3 is a html page, the frame source is Page 4 There is a javascript:history.go(-1) link on Page 4. I want to go back to page 1 (not inside the frame, i want it to go back to the previous page just like when you click the "back" button of your browser) or go back to page 2 (whichever one is the last page) but the link doesn't work because it's inside a frame... If i go directly to page 4 without using the page with the frame (page 3) the link will work and get me back to page 1 or page 2... some help would be appreciated !! Hi, I need a javascript function to show and allow user to access Browser stored Favorites and Recent History in a web page. Thanks, GravityPush Hi, I need your help guys. I've got a little problem. I have some smileys which I enter to a textarea when clicking on them. It works perfect, but once the user clicks on a smiley, the focus goes off of the textfield. I use document.getElementById('message').value += smileycode It works perfectly, it enters the smileycode to the textarea. My problem is... When I say document.getElementById('message').focus() it goes back to where the cursors has last been so before the smileycode. Instead of this, I want the focus to go back after the insertion of the code. I hope it's understandable. And thanks in advance! 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? The question is on iframes/bookmarkablity and back button functionality. This issue I am facing is how to create iframes with bookmarkable url's without loosing the back button functionality.Lets say all the pages are in the same domain and the child pages inform parent of the child page load for updating the window.location.hash property to modify the current browser address bar. The updation of the url works fine on IE/FF/webkit. But the back button works as expected in IE-8 but the browser back-button does not work in FF/webkit (just the url changes the previous page is not loaded). If we don't update the window.location.hash property the back button works but the window url is not meaningful. Is there a way to get this functionality accross browsers, or is there an easier better way to do it (any other js libs). All pages are served from the same server to get around the permission issue. Gmail and other sites looks like they does something like this. I've been working on a site where the content is displayed in an iframe. The iframe content is on a different domain than the iframe itself. I've already got around the cross-domain problems by creating a file on the parent domain that the iframe content references via another iframe. (which uses parent.parent to skip the permissions issue) That was all fine and pressing back and forward in the browser navigated back and forward in the iframe (at least in FF, not 100% sure about other browsers) Then the client wasn't happy that the url in the browser didn't change and pages couldn't be bookmarked. So I created a solution where the parent.parent.location.href was changed to be domain.com/#/path/to/iframecontent.php so that pages could be bookmarked, that works fine but now back and forward don't work, or more specifically the url changes correctly but the iframe content doesn't go back. Right so I have a popup window that when opened in any browser expect of course IE will open perfectly in the centre of the screen. However with IE it decides to jump to the top of the page, then is pushed back down to just show the popup at the bottom of the window. Anyone got any idea how I can stop this? Using IE8. Code: function openPopup_JD(params){ var name = params.name; var blanket = params.blanket || true; var effect = params.effect || "fade" var afterOpen = params.afterOpen || ""; var width = document.getElementById(name).style.width; var height = document.getElementById(name).style.height; width = width.slice(0, -2); height = height.slice(0, -2); width = width * 1; height = height * 1; document.getElementById(name).style.left = getLeft_JD(width) + "px"; document.getElementById(name).style.top = getTop_JD(height) + "px"; //Create blanket if it doesn't already exist. if(!document.getElementById('blanket')){ var popupBlanket = document.createElement("div"); popupBlanket.id = 'blanket'; popupBlanket.style.display = "none"; popupBlanket.style.opacity = 0; popupBlanket.style.filter = 'alpha(opacity = 0)'; popupBlanket.style.backgroundColor = "#000"; popupBlanket.style.position = "absolute"; popupBlanket.style.zIndex = 9998; popupBlanket.style.top = "0px"; popupBlanket.style.left = "0px"; popupBlanket.style.width = "100%"; popupBlanket.style.height = getBlanketHeight()+"px"; document.body.appendChild(popupBlanket); } switch(effect){ //----------------------------------- //FADE IN //----------------------------------- case "fade": if(blanket == true){ animate_JD({ objects: 'blanket |'+name, properties: "opacity |opacity", start: "0", end: "0.75 |1", inerval: "20 |20", frames: "15 |20", effect: "SFS", wait: "0 |-1", onStart: "toggle('blanket') |toggle('"+name+"')", onComplete: " |"+afterOpen }); }else{ animate_JD({ objects: ''+name, properties: "opacity", start: "0", end: "1", interval: "20", frames: "6", effect: "SFS", wait: "0", onStart: "toggle('"+name+"')", onComplete: ""+afterOpen }); } break; Not all of the function is shown because below this are only other effects Hello all, I needs some help. I currently have a script to jump to an anchor tag when the page loads: Code: <script type="text/javascript"> function goToAnchor() { location.href = "myPage.html#myAnchor"; } </script> Now, I would like to take it a step further and would like to link from page A to page B that usually takes a while to load and once the page loads, run a script to jump to the specified anchor tag on the page after everything has loaded. I know I have to add some parameters at the end of the url link on page A, but that's where I get stuck. Can anyone please help? |