I'm making a shopping mall website using a Yahoo solution. I have multiple options for items and some items have different price dependent on the options.
Yahoo doesn't support multiple price options, and therefore I try to find a solution for this problem. One of my ideas is to make multiple pages and redirect the page dependent on options. For example, if a customer chose model A, the page will stay in the page A which displays $1000. If a customer chose model B, the page will redirect to the page B which displays $500.
I have already made dynamic options with JavaScript, but I want to modify it to redirect a page. Here is the link of my page:
http://parseven.com/callaway_diabloedge_iron.html
In the page, there are options in the middle. If a customer chose his/her hand, it shows options, "#4 Thru AW," "Lob Wedge," and "Sand Wedge." If a customer chose either "Lob Wedge" or "Sand Wedge', the page has to redirect to a page which has a different price.
PS:
I'm using JavaScript to generate options dependent on the previous option. The code is:
<script type="text/javascript" language="javascript"> <!-- document.write('<select name="Iron(s)" onChange="javascript: listboxchange (this.options[this.selectedIndex].value);"><option value="">Select Iron(s)</option></select>') --> </script>
How to Redirect to Another Page in HTML. To redirect one HTML page to another page, you need to add a <meta> tag inside the <head> section of the old HTML page. The <head> section of an HTML document contains metadata that is useful for the browser, but invisible to users viewing the page.
Answer: Use the JavaScript window. location Propertylocation property to make a page redirect, you don't need any jQuery for this. If you want to redirect the user from one page to another automatically, you can use the syntax window. location. replace("page_url") .
Use:
window.location = "http://my.url.here";
Here's some quick-n-dirty code that uses jQuery to do what you want. I highly recommend using jQuery. It'll make things a lot more easier for you, especially since you're new to JavaScript.
<select id = "pricingOptions" name = "pricingOptions"> <option value = "500">Option A</option> <option value = "1000">Option B</option> </select> <script type = "text/javascript" language = "javascript"> jQuery(document).ready(function() { jQuery("#pricingOptions").change(function() { if(this.options[this.selectedIndex].value == "500") { window.location = "http://example.com/foo.php?option=500"; } }); }); </script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With