undefined

Google-首页效果图-源代码

陌路散爱 提交于 2020-01-15 05:04:33
1、本小程序分三个小文件:index.js,main.htm,toolbar.png. main.htm里面有个id为tb的div,负责呈现那中很玄的效果 index.js主要负责计算展示图片的位置(坐标)和attachEvent toolbar.png是各种效果的组合.下面就把各个文件拿出来展示一下. 2、各个文件内容 1)main.htm < html > < head > < meta http-equiv ="content-type" content ="text/html; charset=UTF-8" > < title > google首页效果图 </ title > < script > google = new Object; </ script > </ head > < body bgcolor =#ffffff text =#000000 link =#0000cc vlink =#551a8b alink =#ff0000 topmargin =3 marginheight =3 > < center > < div style =" margin:100px 100px 30px 100px" >< img src ="images/logo.gif" border ="0" /></ div > < div id ="tb" ></ div > </

JavaScript基础2——关于变量

可紊 提交于 2020-01-14 18:42:40
变量的声明 变量的定义:使用var关键字来声明,区分大小写的。 注意 :不用var,会污染全局变量 。 变量的命名规范是:字母,数字,$符和下划线构成,但是不可以以数字开始,并且变量名不可以使用关键字。 1、声明变量 1 <script type="text/javascript"> 2 var i=123;//使用var关键字声明变量 3 var s="Jackie"; 4 temp="直接赋值使用变量";//如果您所赋值的变量还未进行过声明,该变量会自动声明。 5 document.write(i+" "+s+" "+temp); 6 </script> 2、重新声明变量 1 <script type="text/javascript"> 2 var i=123;//使用var关键字声明变量 3 var i;//在重新声明该变量后,变量的值不会被重置或清除。 4 document.write("i的值是:"+i);//i的值还是123 5 </script> 3、 命名习惯 变量命名都以类型前缀+有意义的单词组成,用驼峰式命名法增加变量和函式的可读性。例如:sUserName,nCount。 前缀规范: 每个局部变量都需要有一个类型前缀,按照类型可以分为: 1 2 3 4 5 6 7 8 s:表示字符串。例如:sName,sHtml; n:表示数字。例如:nPage

Iterate over Array with empty elements (ES6)

喜欢而已 提交于 2020-01-14 17:50:49
问题 I have an array with a specified length and I'm trying to populate it with values that are dependent on each index. let arr = new Array(someLength) arr.map((v, i) => i * 2) From what I know, this isn't working because map skips undefined values. I have a few questions: Why does map work on something like [undefined, undefined] ? Is there anyway to accomplish this using ES6 array methods? I know I can use a standard for loop, but was wondering if there's a nicer way to do it. for (let i = 0; i

Iterate over Array with empty elements (ES6)

走远了吗. 提交于 2020-01-14 17:50:27
问题 I have an array with a specified length and I'm trying to populate it with values that are dependent on each index. let arr = new Array(someLength) arr.map((v, i) => i * 2) From what I know, this isn't working because map skips undefined values. I have a few questions: Why does map work on something like [undefined, undefined] ? Is there anyway to accomplish this using ES6 array methods? I know I can use a standard for loop, but was wondering if there's a nicer way to do it. for (let i = 0; i

Javascript recursion function returning undefined

大城市里の小女人 提交于 2020-01-14 04:32:06
问题 I'm not even certain what the title of this question should be - I'm not sure what is going wrong at all. I'm writing a function that simply loops through a binary tree. Let us say we have a simple tree such as: testTree = { data: 5, left: { data: 10, left: undefined, right: undefined }, right: { data: 2, left: undefined, right: undefined } } We're trying to collect the data from it, starting with going the left-most path. Here is the search left function: function searchLeft(node, path){ if

'Headers' is undefined in IE11

杀马特。学长 韩版系。学妹 提交于 2020-01-14 03:38:06
问题 I am using angular2csv where I export the data displayed in the table to csv. I add the headers using , export() { const head = ['Header1', 'Header2', 'Header3', 'Header4', 'Header5']; const exportErrors = new Angular2Csv(this.items, this.obj.value, { headers: (head) }); } It works fine in CHROME, but on IE11, it gives me an error saying 'ERROR ReferenceError: 'Headers' is undefined'. What is the issue here? What is the alternative to headers in IE11. 回答1: I just encountered this on a

javascript set a variable if undefined

假装没事ソ 提交于 2020-01-11 14:48:31
问题 I know that I can test for a javascript variable and then define it if it is undefined, but is there not some way of saying var setVariable = localStorage.getItem('value') || 0; seems like a much clearer way, and I'm pretty sure I've seen this in other languages. 回答1: Yes, it can do that, but strictly speaking that will assign the default value if the retrieved value is falsey , as opposed to truly undefined . It would therefore not only match undefined but also null , false , 0 , NaN , ""

AngularJS - Simple $scope console.log() returns undefined

吃可爱长大的小学妹 提交于 2020-01-11 04:39:12
问题 I'm trying to make a simple console.log() from this $scope: <div ng-controller="CustomerController" id="customer-block"> <h3>Customer Information</h3> <div class="col-md-4"> <label>Address 1:</label> <input type="text" ng-model="customer.address1" class="form-content" id="customer-address1" /> </div> <div class="col-md-4"> <label>Address 2:</label> <input type="text" ng-model="customer.address2" class="form-content" id="customer-address2" /> </div> <div class="col-md-4"> <label>City</label>

PHP undefined variable mysqli connection

瘦欲@ 提交于 2020-01-11 03:30:07
问题 I have a mysql connection which is included in a separate file: require 'settings.php'; and I have a file with all functions, also included: require 'functions.php'; In the settings there it looks like this: $db = mysqli_connect("host", "username", "passwort", "database"); if(!$db) { exit("Error: ".mysqli_connect_error()); } and a function uses this connection like this: function includehomepage() { $data = array(); $query = "SELECT pagecontent FROM `pages` WHERE `id` = `0`"; $query = mysqli

前端之js基础篇

岁酱吖の 提交于 2020-01-09 06:42:21
JavaScript概述 ECMAScript和JavaScript的关系 1996年11月,JavaScript的创造者--Netscape公司,决定将JavaScript提交给国际标准化组织ECMA,希望这门语言能够成为国际标准。次年,ECMA发布262号标准文件(ECMA-262)的第一版,规定了浏览器脚本语言的标准,并将这种语言称为ECMAScript,这个版本就是1.0版。 该标准一开始就是针对JavaScript语言制定的,但是没有称其为JavaScript,有两个方面的原因。一是商标,JavaScript本身已被Netscape注册为商标。而是想体现这门语言的制定者是ECMA,而不是Netscape,这样有利于保证这门语言的开发性和中立性。 因此ECMAScript和JavaScript的关系是, 前者是后者的规格,后者是前者的一种实现 。 ECMAScript的历史 年份 名称 描述 1997 ECMAScript 1 第一个版本 1998 ECMAScript 2 版本变更 1999 ECMAScript 3 添加正则表达式 添加try/catch ECMAScript 4 没有发布 2009 ECMAScript 5 添加"strict mode"严格模式 添加JSON支持 2011 ECMAScript 5.1 版本变更 2015 ECMAScript 6