I am trying to set up my website, so that a particular link isn’t visible until the user clicks another link. I am unable to sort out how to make it change the visibility. Making it hidden using CSS is straight forward but I can’t make the JS make it visible again.
Here is my JS code: The Problem is in the last function.
And here is the website:
Thanks for your help. My Javascript knowledge is a bit limited, so please make sure your answers are fairly clear.
Here is my JS code: The Problem is in the last function.
Code:
function mouseOver(img_name, img_src)
{
document[img_name].src = img_src;
}
function mouseOut(img_name, img_src)
{
document[img_name].src = img_src;
}
function changeImage(newimage) {
var changeimg = document.getElementById("imgchange");
changeimg.src = newimage;
}
function changedescription(newtext) {
var description = document.getElementById("description");
description.innerHTML = newtext;
}
function changewebaddress(newtext) {
var webdescription = document.getElementById("webdescription");
webdescription.innerHTML = newtext;
}
function changeurl(newurl) {
var siteurl = document.getElementById("siteurl").href = newurl;
siteurl.innerHTML = webdescription;
siteurl.href = newurl;
}
function urlvisability(urlhideshow) {
if (document.getElementById("siteurl").style.display = 'none')
{
(document.getElementById("siteurl").style.display = 'visible')
}
}
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wordpress Websites</title>
<link href="home2012 css.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="home2012JS.js"></script>
</head>
<body>
<div class="maincontainer">
<div class="navshow" id="navshow">
<ul class="navshow">
<li class="liheadingshow">
<h2>Wordpress Websites</h2>
</li>
<li><a href="#" onclick="changeImage('imgs/sampleMIC.gif'),
changedescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras dui justo, cursus quis varius mattis, convallis nec justo. Suspendisse potenti. Suspendisse quis mauris lorem. Maecenas at nunc tortor, nec laoreet velit.'),
changeurl('http://meditateincopenhagen.org/')
; return false">Meditate in Copenhagen</a></li>
<li><a href="#" onclick="changeImage('imgs/sampleMIB.gif'), changedescription('In laoreet sem vel mi suscipit placerat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.'),
changeurl('http://meditasjonibergen.no/')
; return false">Meditate in Bergen</a></li>
<li><a href="#" onclick="changeImage('imgs/sampleNDC2012.gif'), changedescription('Proin facilisis velit vitae augue semper vitae sodales odio malesuada. In a nisl sit amet dui placerat rutrum vel vel tellus. Phasellus leo velit, pharetra id scelerisque eget, volutpat eu ipsum. Pellentesque eget ante justo, vel dignissim odio.'), changeurl('http://kadampafestivals.org/scandinavia/')
; return false">2012 - Nordic Dharma Celebrations</a></li>
<li><a href="webdesign.html">Back</a></li>
</ul>
</div> <!--End of navbar -->
<div class="imgflipshow">
<p><img src="imgs/wordpresspage.png" width="350" height="200" id="imgchange"/></p>
<p class="description" id="description">Click on one of the site from the menu to learn more.</p>
<a id="siteurl" href="">Click here to visit the site!</a>
</div>
</div>
</body>
</html>
Comment