Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ****************************************************
- // Function to convert HTTP GET parameters to view parameters
- // This will validate the view cache
- // url - url of page to send view parameters to
- // id_array - list of HTTP GET id's
- // ****************************************************
- function httpToViewParameters( url, id_array )
- {
- url = url + '/';
- if ( url === '//' ) url = '/';
- for ( var id in id_array )
- {
- var element = document.getElementById( id_array[id] );
- var val = '/' + ( element.value || '' ) + '/';
- var name = '(' + element.name + ')';
- if ( element.type == 'checkbox' && !element.checked )
- val = '/0/';
- if ( url.match( '/\(' + name + '\)\/(\w+)?\//' ) )
- url = url.replace( name + '/' + RegExp.$1 + '/', ( val == '//' ? '' : name + val ) );
- else if ( val !== '//' )
- url = url + name + val;
- }
- window.location = url;
- return false;
- }
Add Comment
Please, Sign In to add comment