www.webdeveloper.com
Results 1 to 2 of 2

Thread: Uncaught TypeError: undefined is not a function

  1. #1
    Join Date
    Jan 2014
    Posts
    10

    Question Uncaught TypeError: undefined is not a function

    I do not understand what is the problem.

    here is the code:

    index.php
    HTML Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <title></title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
        <script type="text/javascript" src="widget/panel.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                var container = new Panel({width:'100%', height:'100%', position:'absolute', BackColor:'#d2d2d2'});
                container.open();
            });
        </script>
    </head>
    <body>
    </body>
    </html>
    panel.js
    Code:
            function Panel(parameters){
                var Width = parameters.Width ? parameters.Width : '100%';
                var Height = parameters.Height ? parameters.Height : '100%';
                var BgColor = parameters.BackColor ? parameters.BackColor : 'transparent';
                var Appearance = parameters.Appearance ? parameters.Appearance : 'none';
                var Outline = parameters.Outline ? parameters.Outline : 'none';
                var Border = parameters.Border ? parameters.Border : '0px';
                var Align = parameters.Align ? parameters.Align : 'left';
                var Padding = parameters.Padding ? parameters.Padding : '0px';
                var Margin = parameters.Margin ? parameters.Margin : '0px';
                var Left = parameters.Left ? parameters.Left : '0px';
                var Top = parameters.Top ? parameters.Top : '0px';
                var Valign = parameters.Valign ? parameters.Valign : 'top';
                var Position = parameters.Position ? parameters.Position : 'absolute';
                var Display = parameters.Display ? parameters.Display : 'none';
                var Float = parameters.Float ? parameters.Float : 'left';
                var verticalscrol = parameters.VScrollBar ? parameters.VScrollBar : 'hidden';
                var horizontalscrol = parameters.HScrollBar ? parameters.HScrollBar : 'hidden';
                var Disabled = parameters.Disabled ? parameters.Disabled : false;
                var Open = false;
                var Self = this;
                var $parent = parameters.$parent ? parameters.$parent : null ;
    
                var $_element = $(document.createElement('div'));
                $_element.attr({
                    'class': 'Panel'
                });
                $_element.css({
                    'width': Width,
                    'height': Height,
                    'background-color': BgColor,
                    'outline': Outline,
                    'align': Align,
                    'border': Border,
                    'padding': Padding,
                    'margin': Margin,
                    'left': Left,
                    'top': Top,
                    'valign': Valign,
                    'position': Position,
                    'display': Display,
                    'float': Float,
                    'overflow-x': verticalscrol,
                    'overflow-y': horizontalscrol
                });
    
                if(typeof $parent == 'undefined'){
                    $parent = $(document.documentElement);
                }else if(!$parent){
                    return false;
                }
    
                $parent.append($_element);
    
                this.isOpened = function(){
                    return false;
                };
    
                this.open = function(callback){
                    if(Open){
                        return false;
                    }
                    Open = true;
                    $_element.stop(true).fadeIn('slow', callback);
                };
    
                this.close = function(callback){
                    if(!Open){
                        return false;
                    }
                    $_element.stop(true).fadeOut('slow', function(){
                        Open = false;
                        if(callback && callback.call()){
                            callback.apply(this, arguments);
                        }
                    });
                };
    
                this.add = function(content){
                    if(typeof content == 'string'){
                        $_element.html($_element.html() + content);
                    }else{
                        $_element.append(content);
                    }
                };
    
                this.clear = function(){
                    $_element.children().remove();
                };
    
                $_element.on('click', this.close);
            }
    the panel.js is my own function

    please help
    I do not understand the problem

    I searched in google but nothing found.
    I check this code in minimum 10 times but no errors found...

    If you can Please Help me!

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,348
    JQuery help is found in the JavaScript frameworks forum.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles