Click to See Complete Forum and Search --> : simple javascript question easy one


dotnetanimal
12-19-2002, 02:32 PM
I am setting a value in my page like this

<script type="text/javascript">
var pagetitle = document.title;
document.write(pagetitle);
</script>

I want to add this to the url and pass it to another page by using something like this. that way when I get there the new page will know the page title of the page I came from:

onclick="window.open('/reports/help/drew.aspx?pagetitle')

When I get to the next page I am going to be retreiving that value and redirecting based on the value.

How do I get the value when I go to the next page and does my on click event look ok? Please help so I can enjoy the holiday.

khalidali63
12-19-2002, 04:24 PM
you can use document.referer to get the URL or the page where you were forwarded from.

Khalid

dotnetanimal
12-19-2002, 04:41 PM
I guess i Could :)

I should explain further that my page is composed f a header.ascx file and that is included in the file default.aspx.

the header.ascx contains all of the logic for navigation.

In that there is a help link that I have. I want that to go to a help page where I grab some value and decide where to redirect. ideally this would be based on the page that the link is coming from. However if I could pass along the title with the request that would also help.

The real problem is that the header.ascx file is the same no matter what page I am on. default.aspx. reports.aspx. . . you get the idea.

Thanks for getting back to me and if you have any other ideas I am all ears. :)

Thanks again

khalidali63
12-19-2002, 05:18 PM
if you want to forward the page title to the next page,then create your new window url

something like this

var newWind = "/reports/help/drew.aspx?"+document.title;

and then use this in window .open call

Khalid