I have a div that needs to open according to the position of a link. The link appears on many pages at different position and the div MUST always open next to it.
how do I do this????
I have a div that needs to open according to the position of a link. The link appears on many pages at different position and the div MUST always open next to it.
how do I do this????
How are you showing the div? It would be much easier to help you out if you could post a link to your site.
here is the code
<html>
<head>
<title>Untitled</title>
<script>
function showd(element) {
var el = document.getElementById(element);
el.style.display = "block";
}
function closeContentD(element) {
var el = document.getElementById(element);
el.style.display = "none";
}
</script>
<style>
.div_watch_commentst_right{position:absolute;left:100px;top:100px;}
</style>
</head>
<body>
<a href="#" onClick="showd('myDivcom')" class="link">link1</a>
<div id="myDivcom" style="display:none;border:1px solid red;width:350px;" class="div_watch_commentst_right">text comes here</div>
<br>
<a href="#" onClick="showd('myDivcom')" class="link">link2</a>
</body>
</html>
I want the DIV to ALWAYS open close to its link
How about this:
Good luck!HTML Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <script> function showd(element) { var el = document.getElementById(element); el.style.display = "inline"; } function closeContentD(element) { var el = document.getElementById(element); el.style.display = "none"; } </script> </head> <body> <a href="#" onClick="showd('myDivcom')" class="link">link1</a> <div id="myDivcom" style="display:none;border:1px solid red;width:350px;">text here</div> <br> <a href="#" onClick="closeContentD('myDivcom')" class="link">link2</a> </body> </html>
not really.sorry
forget about the close function.
I want both my links to open the same div but the div will be positionned next to the relevant link
Bookmarks