0

I am using the below JS for making a url

function reload(form){
var val1=form.dav.options[form.dav.options.selectedIndex].value;
var val2=form.pathogen.options[form.pathogen.options.selectedIndex].value;
var val3=form.topicF.options[form.topicF.options.selectedIndex].value;
var val4=form.ind.options[form.ind.options.selectedIndex].value;
var val5=form.subind.options[form.subind.options.selectedIndex].value;
self.location='/node/1?davQ=' + val1 + '&pathogenQ=' + val2 + '&topicQ=' + val3 + '&indQ=' + val4 + '&subindQ=' + val5;

This code works well, but the problem is every time its run the page flick's and all elements appear after a blink. !.

How can I prevent the page flicker/blinks. I use this function in onchange of list box in the page to update the url.

Is there any alternative way to do this ? pls help.

Note:

In this case the url is addedd to the address location when the first listbox value is selected and all other parameters get update while user selects the other listboxes and finaly the submit the page its run a query in database using the value get stored in the url.

http://localhost:8080/lspo/data10.php?davQ=30-Aug-11&pathogenQ=&topicQ=&indQ=&subindQ= so when ever drop downs are selected each parameter updates. Is this can be done using any other method which the page will stay as smooth as it is ? Pls help/advice in this matter.

02-05-2012

When a dropdown value is selected, its value is updated in addressbar url, at the same time it get updates in field and with respect to that the next drop down field value is generated (sql query from mysql db). Please help me to solve this issue.

09-05-2012 Hi, I was unable to find a solution upto now, I had gone through the suggestion and couldn't able to solve the issue. Is there any other suggestions. It will be a real help for me if there any and thank you very much for the responses.

Gopipuli
  • 371
  • 1
  • 8
  • 33

2 Answers2

2

history.push()

http://html5doctor.com/history-api/

or use something like swfaddress

j_mcnally
  • 6,723
  • 1
  • 27
  • 46
  • In my page once the first listbox is selected the url is loaded to address bar (localhost:8080/tess.com/node/…). Then each time a listbox selected the value get updated in the url. Will this be done using above methods. When I checked the sample site. It update only one parameter each time – Gopipuli Mar 06 '12 at 06:58
  • Yes. Swf address depends on the HashBang, History push will actually change the url. You can also push parameters as part of a json object for additional state information. – j_mcnally Mar 06 '12 at 07:14
  • Is there any possible link available (example) for the above ? thanks in advance – Gopipuli Mar 06 '12 at 08:46
  • swf address use flash!.. In mine there is no flash files used the whole site is done in drupal 6. PHP and Javascript done to make contents for the site... – Gopipuli Mar 06 '12 at 10:00
  • Swf address also works for javascript ajax if you read the docs. Actually even the title: Deep linking for Flash and Ajax – j_mcnally Mar 06 '12 at 17:09
0

There is hash function in javascript or you can us html5 history API

sandeep
  • 2,196
  • 1
  • 23
  • 36
  • Is there any sample code or site to check the above said function ? – Gopipuli Mar 06 '12 at 06:22
  • some good url http://www.oshyn.com/_blog/General/post/JavaScript_Navigation_using_Hash_Change/ http://stackoverflow.com/questions/136458/how-do-i-with-javascript-change-the-url-in-the-browser-without-loading-the-new http://stackoverflow.com/questions/298503/how-can-you-check-for-a-hash-in-a-url-using-javascript – sandeep Mar 06 '12 at 06:25
  • In my page once the first listbox is selected the url is loaded to address bar (http://localhost:8080/tess.com/node/1?davQ=30-Aug-11&pathogenQ=&topicQ=&indQ=&subindQ=). Then each time a listbox selected the value get updated in the url. Will this be done using above methods. When I checked the sample site. It update only one parameter each time. – Gopipuli Mar 06 '12 at 06:58