422,949 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,949 IT Pros & Developers. It's quick & easy.

Problems reloading same page with new parameters

P: 2
I have a web page and lots of XML files. When a link is clicked on the page, it calls a function via onclick with the XML file as a parameter:

[HTML]<body onload="InitContent();">
<a name="fileName" class="blah" href="javascript: void(0)" onclick="OpenColumnInfo('fileName')">Whatever</a>
</body>[/HTML]
OpenColumnInfo() takes the filename and reads in the relevant XML then squirts the contents into various tags on the current page, so there is no reload. This works fine, but the browser navigation buttons obviously don't change.

In an effort to get the back button working I thought I could just change OpenColumnInfo() to reload the page by calling one of:

Expand|Select|Wrap|Line Numbers
  1. window.open(http://www/etc/page.htm?fileName, "_self")
  2. window.location.href = "http://www/etc/page.htm?fileName"
I also changed the link to set href="".

However, when InitContent() is called by the reload, I notice that window.location.href = http://www/etc/ so it loses the htm filename and the parameter. I found it did sort of work with:

Expand|Select|Wrap|Line Numbers
  1. window.open(http://www/etc/page.htm?fileName)
In the sense that the new window was correct, but the old window also reloaded only with no parameters, so it lost what had been there. Anyway, I need it to stay in a single window.

Curiously, I note that if I remove the attribute href="" completely, then it does work, but the pointer no longer changes to a hand when over a link.

I'm currently working on IE7.0, though it will need to work on IE6.0 also.

Can anyone explain where I'm going wrong?
May 18 '07 #1
Share this Question
Share on Google+
7 Replies


dmjpro
100+
P: 2,476
I have a web page and lots of XML files. When a link is clicked on the page, it calls a function via onclick with the XML file as a parameter:

[HTML]<body onload="InitContent();">
<a name="fileName" class="blah" href="javascript: void(0)" onclick="OpenColumnInfo('fileName')">Whatever</a>
</body>[/HTML]
OpenColumnInfo() takes the filename and reads in the relevant XML then squirts the contents into various tags on the current page, so there is no reload. This works fine, but the browser navigation buttons obviously don't change.

In an effort to get the back button working I thought I could just change OpenColumnInfo() to reload the page by calling one of:

Expand|Select|Wrap|Line Numbers
  1. window.open(http://www/etc/page.htm?fileName, "_self")
  2. window.location.href = "http://www/etc/page.htm?fileName"
I also changed the link to set href="".

However, when InitContent() is called by the reload, I notice that window.location.href = http://www/etc/ so it loses the htm filename and the parameter. I found it did sort of work with:

Expand|Select|Wrap|Line Numbers
  1. window.open(http://www/etc/page.htm?fileName)
In the sense that the new window was correct, but the old window also reloaded only with no parameters, so it lost what had been there. Anyway, I need it to stay in a single window.

Curiously, I note that if I remove the attribute href="" completely, then it does work, but the pointer no longer changes to a hand when over a link.

I'm currently working on IE7.0, though it will need to work on IE6.0 also.

Can anyone explain where I'm going wrong?

i don't understand http://www/etc/page.htm?fileName....
May 18 '07 #2

P: 2
That's just my simplified description of the url. Is it my forgetting to add the quotes that's confusing?

The actual line is:

Expand|Select|Wrap|Line Numbers
  1. window.open("http://localhost:50847/ColumnHelp/default.htm?Column=MVGrossDelta", "_self");
May 18 '07 #3

acoder
Expert Mod 15k+
P: 16,027
What does InitContent do?
May 21 '07 #4

dmjpro
100+
P: 2,476
Does HTML can generate a dynamic web-page????
May 21 '07 #5

acoder
Expert Mod 15k+
P: 16,027
Does HTML can generate a dynamic web-page????
Using javascript, yes.
May 21 '07 #6

dmjpro
100+
P: 2,476
ACODER i think u misunderstood me.....

i mean to say .... is it a valid URL ....
localhost:50847/ColumnHelp/default.htm?Column=MVGrossDelta

soryy ......
plz forgive me if anything wrong with my attitude.

kind regards.
dmjpro.
May 22 '07 #7

acoder
Expert Mod 15k+
P: 16,027
Using the search property, it is possible to work with the query strings.
May 22 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.