REGISTER FREE to Receive Instant Job

Wednesday, 5 December 2012

History and Back Button Support


Example of history.back in jquery(History and Back Button Support)


<!-- The back() method loads the previous URL value in the history list.--><!-- The history.back method loads the value from previous page when using back button --><!-- Copy history.back method to every page where you want to get previous selected data on back button--><script language="javascript" type="text/javascript"> <!-- Start JavaScript Method Here.-->

if(history.back)
{
<!-- ElementIdArray is a variable which define element ID of select tag which you want to menatin history on previous page after using back button like: see example-->

var ElementIdArray = ['ElemnetIDFirst', 'ElemnetIDSecond'];

<!-- SelcetOptionArray is a variable which define value of select tag which you want to menatin history on previous page after using back button like: see example -->

var SelcetOptionArray = ['SHOW OPTION VALUE IN DROP DOWN', 'SHOW OPTION VALUE IN DROP DOWN'];

for (var i=0; i<ElementIdArray.length; i++) {
            
common_function(ElementIdArray[i],SelcetOptionArray[i]);    
            

    
}
function common_function(ElementIdValue,SelectOptionValue)
{
    
var DefineVariable=document.getElementById(ElementIdValue);
DefineVariable.options.length = 0; 
var opt = document.createElement('option');
opt.text =SelectOptionValue ;
try
{
DefineVariable.add( opt, null );                        
}
catch(ex)
{
DefineVariable.add( opt );        
}       
document.getElementById(ElementIdValue).disabled=true;
}

<!--END JavaScript Method Here.-->

</script>

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.