I am working on a script that allows a link’s text to be changed from Show Video to Hide Video and back. However, I can’t get this to work, as it changes but won’t change back. ? My script:
[code=html]<head>
<script language=”javascript”>
// I wrote this. The alert is to see if the var changes.
var chText = “Hide Video”
function change(){
if (chText == “Hide Video”) {
var chText = “Show Video”;
}
else {
var chText = “Hide Video”;
}
alert(chText)
}
</script>
<script language=”javascript”>
//Not mine. It works fine.
function changeText(currentElement){
currentElement.firstChild.data=chText;
}
</script>
</head>
<body>
<a href=”#” onclick=”change(), changeText(this)”>Show Video</a>
</body>