Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 66973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:11:14+00:00 2026-05-10T19:11:14+00:00

I have two html pages, when you click on something on the first html,

  • 0

I have two html pages, when you click on something on the first html, it will go to the second one. What I want to do is to show text according to what you clicked on the first html. different texts are wrapped with different ids. Here’s how I wrote:

<a href='secondpage.html#one'></a> <a href='secondpage.html#two'></a> <a href='secondpage.html#three'></a> 

I’m expecting to see two.html load the text with id ‘one’, but it doesn’t work, does anyone know what I did wrong?

Here’s the code on second page:

<ul id='menu' class='aaa'>     <li><a id='one' href='#'>one</a></li>     <li><a id='two' href='#'>two</a></li>     <li><a id='three' href='#'>three</a></li> </ul> 

And I have a JS file to modify each id:

$('one').observe('click', function() {     $('Pic').writeAttribute('src','picone.jpg');     $('Bio').update('texthere!'); }); 

Same for two and three.

Right now if I click on a button on the first page, it will always show the text and pic for ‘one’, no matter which button I click.

But I want to see the pic and text for ‘two’ if i click on it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:11:14+00:00Added an answer on May 10, 2026 at 7:11 pm

    What you want to do is simulate a click on your anchor when the page loads. Since you’re using jQuery, the simplest approach (but far form best) would be the following:

     $(window).observe('domready', function () {     $(location.hash).click(); }); 

    attach ondomready-event to window. Fetch element with id=one (with jQuery this would be ‘#one’, same as your location.hash would be, very handy in this case), trigger a click on it.

    You might need to replace $(location.hash).click(); with $(location.hash).get(0).click() since jQuery tend to return arrays of jQuery-objects.

    But a better solution in your case would be to have an event-handler that you can trigger manually, thus circumvent the need of firing events, aswell as drop the anchors and put onclick directly on your li’s.

    And furthermore, why do you load a second page when all you seem to want to do is to show/hide content dynamically? Do it on the same page…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say i have two pages links.html & contents.php ... first page contains only
I have two html pages one index.html and groups.html each page as ul >
I have two html pages on my webserver www.example.com/desktop.html www.example.com/mobile.html In principle the content
Lets say there are two pages with two different html elements which have the
I have the exact same html sitting on two different servers. Both pages call
I have two text boxes t1 and t2 in an html page. I'd like
Let's say we have two flash objects on the same html page. I want
I have an HTML page and I want to fetch the result between two
In my html page, I have one table, for every row there are two
Let's say that I have two html pages that are identically designed, but have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.