PDA

View Full Version : Javascript Form Resubmission Doesn't Work


zylstra
05-11-2003, 01:52 AM
Javascript code that receives information from a textbox and that I use to populate frames only works the first time I use it.

The code is:

<script language=javascript>
function showInfo() {
parent.altavista.document.location.href = 'http://www.altavista.com/web/results?kgs=0&kls=1&avkw=xytx&q=link%3Awww.' + document.domainform.domain.value;
parent.alexa.document.location.href = 'http://www.alexa.com/data/details/traffic_details?q=&url=' + document.domainform.domain.value;
document.domainform.textbox.value = 'check '+document.domainform.domain.value;
return false;
}
</script>

But I don't think the code is the problem. I seems that the javascript doesn't run code if it thinks that it has already been run. Is there some way to reset it? I've already tried reseting the form with the Javascript code, but that didn't work.

The frames with code can be seen at http://www.globalnotion.com/website.htm .

Thank you for all of your help,
zylstra

cheesebagpipe
05-11-2003, 02:38 AM
Instead of

parent.altavista.document.location.href =

..try

parent.altavista.location =

...and so on. It's really window.location you want to change. Although document.location is mapped to window.location, you need access to the document object to program it, and those search pages are from other domains.

zylstra
05-11-2003, 07:06 PM
Cheesebagpipe,

Thanks so much. That is awesome of you to respond so quickly and helpfully.

zylstra