• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to change the content of hyperlinks dynamically in the same page using javascript , html and css

 
krishnamurthy durgam
Greenhorn
Posts: 13
Hibernate Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


hi friends i am new to web development environment i was developed i html page using css and javascript.
my problems is when i clicked the hyperlink related page content can not be displayed only name is displayed. please help me how to display the content of hyperlinks Or anchor tags with in the same using HTML, CSS, and JAvascript.
my code is
**index.html**
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> MenuBar </title>

<script type="text/javascript"><!--
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
//--></script>
</head>

<body>
click me


Contacts
   Services
  About


<div
id="example1div"
style="border-style:solid;
height:100px;
margin-top:100px;
padding:10px;
text-align:center;">
i will change

</div>

</body>
</html>
and my related pages are
**contacts.html**
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Contacts </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>
contact me 7774890465

</body>
</html>

**services.html**

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> services</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>
we are offering services medicals related things
</body>
</html>
**about.html**

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>
i am a new to web designer
</body>
</html>

please hlep me

thanks
krishna Murthy
 
K. Tsang
Bartender
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see what you are trying to do. Eg click on "contacts" will show contacts.html content

But how/where are you trigger/call your js function? I don't see that in your code.

 
krishnamurthy durgam
Greenhorn
Posts: 13
Hibernate Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks K.Tsang,

I don't know how to achieve this so i posted

please help me
Thanks
krishna
 
K. Tsang
Bartender
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't answered the "how" part? If you did, you would have solved your own problem

<a href="....">blablabla</a>

What goes in the ...?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic