Forum Moderators: open

Message Too Old, No Replies

External Link Problem, Please Help

Trying to show div on target page from external page link

         

jester13

7:13 pm on May 3, 2004 (gmt 0)

10+ Year Member



Ok, here's what i've got. An internal page with all content in seperate divs rather than linking to seperate .htm files..
On the internal page i have a menu system that uses a hide/show div javascript function to display the proper content. this part works, however i need a way to link from index.htm to internal.htm while at the same time activating the showdiv function for the correct content.
i have tried using the onClick of the index.htm link to activate an external onload but that gives me an object expected error. if anyone can help this with i'd really appreciate it.

Bernard Marx

8:21 am on May 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could you run that past us again?

What's an internal page .. iframe?

jester13

2:02 pm on May 4, 2004 (gmt 0)

10+ Year Member



ok..
let me try to break this down a little better.
i have an internal page:
internal.htm
there is a menu on internal.htm that shows/hides the divs containing the content on internal.htm..
(ex [mgccc.edu...] )

i also have a front page:
index.htm
there is a menu on index.htm that needs to href to internal.htm and at the same time activate the javascript function to showdiv the correct content related to the link that was clicked on the index page.
(ex [mgccc.edu...] )

hopefully this clears things up. thanks again for any help on this.

Bernard Marx

8:34 pm on May 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I gottit now. You need to

1. Pass certain info to the new page.
2. Emulate a click on the appropriate button on the new page.

I had to do that a while ago, and used the solution outlined in this post:
[webmasterworld.com ]
(Forget the complicated version)

That method certainly works, but, as it appears in the address bar, it's not 'invisible' in the way that a cookie-based approach might be. I do favour it though, because - if developed a little further - can allow for the state of the page (ie: which div is shown) to be bookmarkable.

The second part is very easy if the browser supports click emulation method for elements.
In ie, you can do: document.getElementById('id').click()
and you're there. This is especially useful if your menu buttons need to change their appearance when their pages are currently in view (not yours at present).

I'm not sure that all browsers support a click method, so the function that you use to interpret the passed search string will have to call all the functions that you have in your HTML 'onclick' attributes, with the correct parameters - while you're at it, you could replace all those calls in those 'onclick'-s with this function.

Am I making any sense?

jester13

2:47 pm on May 5, 2004 (gmt 0)

10+ Year Member



I think I am understanding, I do, however need to make it work in other browsers as well as other operating systems, what would be the best way to check for compatibility on this? Try it and test it?
thanks again

Bernard Marx

3:11 pm on May 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's all you can do (unless you are of a religious persuasion).