Linking a Drop down box to open information from another page in original page
I'm looking to create a page开发者_开发百科 which has a drop down box that when submitted will open information from another page which will load underneath the drop down box. I think I could do this with a div but I am new to writing code and have completely confused myself.
Any help would be greatly appreciated.
you can use a jquery pop up for that. It is easy to make stylish pop ups which will attracts users attention. Pls refer the link http://jqueryui.com/demos/dialog/ .U can find the demo and code der. It is easy. Please have a look at der.
HTML
<select id="mySelect">
<option value="">Select a Page</option>
<option value="http://www.google.com">My Page</option>
</select>
<iframe id="myIframe"></iframe>
You then need to use javascript to bind an onChange handler to your select box which updates the "src" attribute of the iframe
Javascript via JQuery:
$(function(){
$("#mySelect").change(function(){
if($(this).val())
{
$("#myIframe").attr("src", $(this).val());
}
else
{
$("#myIframe").attr("src", null);
}
});
});
If you want to insert the xml/html/text from another page into the DOM of the current page, you'll want to use AJAX, I recommend looking at the jquery ajax docs to get started:
$.ajax
精彩评论