javascript says my function doesn't exist

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

javascript says my function doesn't exist

Post by daedalus__ »

i have some code:

Code: Select all

<html>
<head>
<meta/>
<title></title>
<script type="javascript">
function toggle()
{
// show or hide div depending on what display is set to
}
</script>
<style>
@import blah.css
</style>
</head>

<body>
<a onclick="javascript: toggle()">toggle div</a>
<div id="toggleme">blah blah blah</div>
</body>
</html>
Internet Explorer gives the error: "Object expected"
Firefox says that the function doesn't exist.

I tried changing the function name, placing it in different parts of the page, and copying functions and calls that I know work from other pages.

Nothing works, same two errors, every time.

I don't know what is wrong.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

<script type="text/javascript">
<a onclick="toggle()">toggle div</a>
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

I'm retarded.

:roll: :roll: :roll:

I meant to say language.

Thanks Weirdan
Post Reply