JavaScript - Multiple Redirect ?!
Hello everyone,
I have a problem in redirecting into multiple pages based on if statement result. I have used 3 redirects, only the first one works "redirect1" when I chose any other option.. it always redirects me to the redirect1 page! Please I need your help experts ! The whole code is attached. Similar TutorialsHI Is there a way to decide where to direct the user dependent on the users choice of multiple radiobuttons - finally triggered by a submit button? Help greatly appreciated Kind regards SamRob Hi, I am trying to redirect a domain to a list of different domains. The code I found on this page works: http://javascriptsource.com/navigation/random-page.html However this provides a random redirect. Ideally I would like the redirect to work in chronological order so that each domain receives the same amount of visitors. For example: Visitors 1 is redirected to DOMAIN A Visitors 2 is redirected to DOMAIN B Visitors 3 to DOMAIN C Visitors 4 to DOMAIN D Once DOMAIN D is visited the sequence would repeat and the next visitor would be directed to DOMAIN A. Is this possible? Is there some way for me to tweak the code on the page above to make this happen? I am an idiot when it comes to coding, and have never have used JavaScript, so any help would be GREATLY APPRECIATED, thanks!! Hi, I hope someone can help me. I'll be honest and say I don't know much about javascript, but am fairly comfortable in html. I am building a website that will have multiple image swaps on multiple pages. I am building this in wordpress, and I'm guessing that means my approach will be different than if I wasn't using wordpress. Here's how one page would work: There are 10 images shown. 1,2,3,4,5,6,7,8,9,10. When number 1 is clicked on, I want a new image - 1a. When 2 is clicked on, 2a. So there are 20 different images in all on a given page. Also, I want the user to be able to click on the image again to restore the original image. I would prefer onclick to onmouseover. There will be literally dozens of pages like this on the site, managed by wordpress, so hundreds of images to swap. Basically the first image is a question - the second image is the answer. Is this possible? what wrong, it just adds the website to the end of the address bar, and it doesnt redirect???help please <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div> <h1>hello</h1> <form onsubmit="return go();"> <select name="website" id="website"> <option value="http://www.google.com/">google.com</option> <option value="www.yahoo.com">yahoo.com</option> </select> <script type="text/javascript"> function go() { var s = getElementById("website"); window.location = s.options[s.selectedIndex].value; return false; //prevents the form from being submitted to the server. } </script> <input type="submit"> </form> </div> </body> </html> Hey all im new to the forum as i have just started playing round with javascript but anyway i have this code PHP Code: setTimeout(top.location='profilec.php?id=' + id,4000); and when executed the time delay is not taken into account at all and completly ignored. If i remove the id var from the code and just have PHP Code: setTimeout(top.location='profilec.php?id=',4000); its fine can anyone tell me why this is happening and if there is a solution :-) thanks before hand mike Hi, I'm trying to redirect my users to their profile, but can't figure out how to put the function into the link. sethighlightedValue(); is a function that returns the users username. Is there anyway else to do this? Here's what I got: Code: case RETURN: window.location = "profile.php?user='setHighlightedValue();'"; this.setHighlightedValue(); bubble = false; break; Hi, I'm trying to change a piece of code I found in a scipt: Code: if (errors == null) { jQuery('#requestform') .hide() .html('<div class="thankyou"><h1>Merci</h1><p>Nous reviendrons vers vous.</p></div>') .show(); } Instead of the .html () I would like to redirect to another webpage of my website, in the same window. Anyone can help me? Thanks. i'm a total noob with java and can't seem to figure this out. i want to add a bit on to the current url : this is the code i'm using , it just keeps adding... Code: window.location=(window.location+"?p=62"); am i even doing this right.. any help appreciated.. I need a weird browser redirect. I need a text box, we will call it variable "A", and a submit button on a form. when the person types in a number such as 51225 into the text box and clicks submit it will redirect them to the page yourdomain.com/51225.php. What is the best way in doing this? Code: <html> <head> <script type="text/JavaScript"> <!-- A=document.form.ID.value function onclick(event) { window.location = http://yourdomain.com/document.write(A).php" } //--> </script> </head> <body> <form name="form"> ID: <input type="text" name="ID" size="6" value=""> <input type="submit"> </form> </body> </html> I know this is not correct but it is a start. I can't figure out how to place the variable into the url. Hi I have several checkboxes in a switch statement like the one below: Code: function whatsChecked(obj) { var indx = obj.id.substring(obj.id.length-1, obj.id.length); switch ( indx ) { case '9': if (document.sport.soccer_9.checked) { //window.open.href = "../google.com";; window.open("../google.com"); } break; } } how can I use a continue button to determine which checkbox was clicked and redirect me to the correct page? Hello, I am new on forum and javascript. I have got a query for dynamic geo location javascript. I would like to make a page which redirect to another page based on user REGION. Ex. If user from EMEA then page1.html, if user from APAC then page2.html, if user from Other region then page3.html Hope someone will share their ideas with an example to achive this. Thanks Theres several redirects probably required, but if it could be 1 script that I could put one 1 html page, that would be amazing (if it is possible). I need the site to: 1. Upon going to site, determine if it is a mobile browser. If so, send visitors to mobile site automatically. If not then continue to step 2. 2. Verify that users can view Flash. If yes check connection speed: A. Send above 60kbits/sec to flash site B. If less send users to html site. If they cannot view Flash, head to step 3 3. For those users that are left, (they can't view flash, and are not using a phone), send them to the html site. I have bolded the 3 versions of the site I have. Please include all code needed, as Im a noob at Javascript programming (explanations on what the lines do would be nice). Thanks Chris Not having a good day...plz help make it WAY better..... Okay, Im hoping people good with Javascript read this because I need help! Theres several redirectes required, but if it could be 1 script that I could put one 1 html page, that would be amazing (if it is possible). I need the site to: 1. Upon going to site, determine if it is a mobile browser. If so, send visitors to mobile site automatically. If not then contninue to step 2. 2. Verify that users can view Flash. If yes check connection speed: A. Send above 60kbits/sec to flash site B. If less send users to html site. 3. For those users that are left, (they can't view flash, and are not using a phone), send them to the html site. I have bolded the 3 version of the site I have. Please include all code needed, as Im a noob at Javascript programming (explanations on what the lines do would be nice). Thanks Chris OK, my javascript is not that good. So I need your help! I need to create a text box that will only work if a certain code is entered. So if 1234 is in the text box and submit is clicked, then it will take you to the site. IF not then it will print "Please enter correct code" next to the submit button. Here is what I have so far: <input name="txtBox" type="text"/> <input name="btnButton" type="button" value="Submit" onclick="return checkValue()" /> <script type="text/JavaScript"> function checkValue() { var secretcode = document.getElementById("txtBox"); if (secretcode == "1234") { document.location.href = 'secret.html'; } } </script> Thank you for your help! I have this offer iframed on my website and I want it so that when they get to a certain page (i have the specific url), I can redirect it to another site. Is this possible by any chance?
Hi guys, I have this script to print a page, which it does fine. However, after the script runs, the browser redirects to the folder root: Code: <SCRIPT Language="Javascript"> //PRINT PAGE FUNCTION function printit(){ if (window.print) { window.print() ; } else { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ""; } } </script> How can I stop this happening? I want remain on the current page! I have data pages in my e-commerce site (from 1999) that are imbedded in a parent page using the object tag. I have started to include a little JS snippet that is intended to redirect to the parent if the embedded pages are loaded separately: Code: <script language="JavaScript" type="text/javascript"> try { if (top == self) {top.location.href='parentpage.htm'; } } catch(er) { } </script> This works fine in Firefox, but in IE 7 and 8 it gets into an infinite loop of reloading the parent page into the object frame. Here is a sample: http://www.greathallminis.com/Ancien...s_anc15_mm.htm (I've left this page with the issue, while I have excluded the script for IE elsewhere.) Is there an alternative and equally simple script for IE, or can I modify this to work for IE? Thanks, Rob Hi, I want to do a redirect count so that the user can see the count going down. for example, I want them to be able to see the following. You will be redirected in 5 seconds. The user should be able to see the count going down from 5 to 4 to 3 to 2 to 1 and then they are redirected. I can get the page to redirect after 5 seconds but I want the user to be able to see it count down. Thanks in advance for your help Hello, I need to improve an existing JavaScript redirect by adding a second redirect based on information contained in the URL. First I will outline the situation, then the specifics: I designed a Realtor website using Joomla 1.5 a few years ago. I will call this SITE-1. The site, SITE-1, displays real estate listing from another site (SITE-2) using iFrames. So the listings from SITE-2 appear to be integrated into the pages of SITE-1. Someone shopping for real estate signs up to be notified of new listings. A new listing comes out and an email is sent to the user with a link to the listing - only the link to the listing is located on SITE-2. So I have been using a JavaScript redirect on SITE-2 that asks the question - "is this in an iFrame" ... if no - redirect to SITE-1 and iframe the results. SITE-1 is ready to receive and parses the new URL: Code: <script language="JavaScript"> <!-- // Start if (window == top) { tops = top.location.href location.replace('http://www.SITE-1.com/index.php?option=com_content&view=article&id=42&Itemid=137&iframe='+tops); } // End --> </script> Now, I have a new problem. I don't have access to SITE-2, I only get to submit a template to them. One of the possible links sent to users from SITE-2 contains a variable in the URL: &id=, followed by a 3 digit number. So the full URL might look like this: http://www.site-2.com/index.php?pg=delacct&id=570 I cannot redirect this to the normal page on SITE-1 because Joomla already uses id=, and it just gets confused and drops a 404 page. Instead I need the code I posted above, to FIRST check for id=. If it exists - go to PAGE-A. If not - then do what the script already does as posted above (we'll call that PAGE-B). Can anyone help? (hopefully I explained that so it can be understood) Thanks, --Kevin |