aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how to change the content of hyperlinks dynamically in the same page using javascript , html and css Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to change the content of hyperlinks dynamically in the same page using javascript , html and css" Watch "how to change the content of hyperlinks dynamically in the same page using javascript , html and css" New topic
Author

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

krishnamurthy durgam
Greenhorn

Joined: Sep 10, 2012
Posts: 13



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

Joined: Sep 13, 2007
Posts: 2359
    
    7

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.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
krishnamurthy durgam
Greenhorn

Joined: Sep 10, 2012
Posts: 13

thanks K.Tsang,

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

please help me
Thanks
krishna
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2359
    
    7

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 ...?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to change the content of hyperlinks dynamically in the same page using javascript , html and css