Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-03-2004, 01:45 PM   #1 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 207
falsepride is on a distinguished road
Help!

can anyone help me with the error in this script? i posted all of the parts that are needed bellow.
<script type="Javascript">
function toggle(objid){
var obj = document.getElementById(objid);
if (obj.style.display == "none") {
ogj.style.display="";
} else {
obj.style.display = "none";
}
}
</script>
<a href="#" onclick="toggle('news')">fgfgfg</a><div id="news" style="display:none">hjklkljklkl</div>
falsepride is offline   Reply With Quote
Old 11-04-2004, 09:23 AM   #2 (permalink)
kaeli69
Registered User
 
kaeli69's Avatar
 
Join Date: Apr 2003
Posts: 30
kaeli69 is an unknown quantity at this point
Quote:
Originally Posted by falsepride
can anyone help me with the error in this script? i posted all of the parts that are needed bellow.
<script type="Javascript">
function toggle(objid){
var obj = document.getElementById(objid);
if (obj.style.display == "none") {
ogj.style.display="";
Is that a typo?
You have ogj instead of obj.

Also, the next time you ask for help with an error, it helps to post what the error is.
kaeli69 is offline   Reply With Quote
Old 11-04-2004, 12:26 PM   #3 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 207
falsepride is on a distinguished road
i hate javascript errors, they're never correct. thats one of the things i love about php, it pin points errors, every time i get a parse error in php, it gives me the right line, but in javascript, it always gives me some random line. anyway the typo didnt fix it, i still get the object expected error. all i need this script to do when i click on a link, i want it toggle the display of a div. to make in display or none.
falsepride is offline   Reply With Quote
Old 11-05-2004, 04:57 AM   #4 (permalink)
kaeli69
Registered User
 
kaeli69's Avatar
 
Join Date: Apr 2003
Posts: 30
kaeli69 is an unknown quantity at this point
That's funny - this works fine for me in IE6.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>

<body>
<script type="text/javascript">
function toggle(objid)
   {
   if (document.getElementById)
      {
      var obj = document.getElementById(objid);
      if (obj.style)
         {
         if (obj.style.display == "none") 
            {
            obj.style.display="";
            }
         else 
            {
            obj.style.display = "none";
            }
         }
      }
   }
</script>
<p><a href="#" onclick="toggle('news')">fgfgfg</a></p>
<div id="news" style="display:none">hjklkljklkl</div>
</body>
</html>
kaeli69 is offline   Reply With Quote
Old 11-05-2004, 10:56 AM   #5 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 207
falsepride is on a distinguished road
i decided to change my system around anyway, i need this for an adminstration part of my site so i can update on computers without ftp programs and what not. now i just have a hidden div, and the javascript changes the innerhtml of another to that of the hidden divs
falsepride is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 02:25 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting