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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 129k
  • Answers 129k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Seems like AppCmd is what I'm looking for ... May 12, 2026 at 5:52 am
  • Editorial Team
    Editorial Team added an answer Are you cleaning up your database connections correctly, i.e. using… May 12, 2026 at 5:52 am
  • Editorial Team
    Editorial Team added an answer Behind the scenes it is using a member pointer and… May 12, 2026 at 5:52 am

Related Questions

I've had a good look through a load of MS documentation only to find
I have an ASP.NET application that implements keep-alive by using a hidden IFRAME with
I have an IE bug that I'm not sure how to fix. Using jQuery
I have put together a script which is very much like the flickr photostream

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.