views:

20

answers:

1

Hi friends, I have to main pages in html with course details. One (X) page has html select option with all courses. If i select in any pages and any one course to apply, then i redirect to X page to user that option has selected by default in X page. I have idea to pass value in url, but how can i retrive the correct option in X pages. I am using only html and javascript. Please provide your any solution in html, js or jquery only. This is purely html site so solution i need in that only and not a programming language like php or any other.

+1  A: 

Do you mean something like this?

<script type="text/javascript">
    function redirect(sel) {
        var url = sel.options[sel.selectedIndex].value;
        if (url) {
            window.location.href = url;
        }
    }
</script>

<select onchange="redirect(this);">
    <option value="">Please select</option>
    <option value="http://www.google.com/"&gt;First (Google)</option>
    <option value="http://www.yahoo.com/"&gt;Second (Yahoo)</option>
</select>
Tim Down
No i am asking some other pages to X page, but your solution is X page to some other pages. Ok anyway it provide the somewhat idea. Thanks for your reply.
Karthik