Dee99
11-08-2010, 03:06 AM
I always get "function not defined" when buttons are clicked - can anyone tell me what's wrong with this code ?
[CODE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>Show and Hiding Images</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
function showImage(){
$('#imgSwitch').show();
}
function hideImage(){
$('#imgSwitch').hide();
}
});//ready
</script>
</head>
<body>
<h1>Showing and Hiding Images</h1>
<p>This is an example of showing and hiding images.</p>
<IMG id="imgSwitch" SRC="./images/grid/SortASC.gif" WIDTH="50" HEIGHT="40" >
<form>
<input type="button" value="show" onclick="showImage()"></input>
<input type="button" value="hide" onclick="hideImage()"></input>
</form>
</body>
</html>
[Icode]
[CODE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>Show and Hiding Images</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
function showImage(){
$('#imgSwitch').show();
}
function hideImage(){
$('#imgSwitch').hide();
}
});//ready
</script>
</head>
<body>
<h1>Showing and Hiding Images</h1>
<p>This is an example of showing and hiding images.</p>
<IMG id="imgSwitch" SRC="./images/grid/SortASC.gif" WIDTH="50" HEIGHT="40" >
<form>
<input type="button" value="show" onclick="showImage()"></input>
<input type="button" value="hide" onclick="hideImage()"></input>
</form>
</body>
</html>
[Icode]