spaghetti = new pasta("wheat", 0.2, "circle", true);
var linguine = new pasta("wheat", 0.3, "oval", true);
//补充定义属性,spaghetti和linguine都将自动获得新的属性
pasta.prototype.foodgroup = "carbohydrates";
148.打印出错误原因
try
{
x = y // 产生错误。
}
catch(e)
{
document.write(e.description) //打印 "'y' is undefined".
}//
149.生成Excel文件并保存
var ExcelSheet;
ExcelApp = new ActiveXObject("Excel.Application");
ExcelSheet = new ActiveXObject("Excel.Sheet");
//本代码启动创建对象的应用
程序(在这种情况下,Microsoft Excel
工作表)。一旦对象被创建,就可以用定义的对
象变量在代码中引用它。 在下面的例子中,通过对象变量 ExcelSheet 访问新对象的属性和方法和其他 Excel 对象,
包括 Application 对象和 ActiveSheet.Cells 集合。
// 使 Excel 通过 Application 对象可见。
ExcelSheet.Application.Visible = true;
// 将一些文本放置到表格的第一格中。
ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
// 保存表格。
ExcelSheet.SaveAs("C:\\TEST.XLS");
// 用 Application 对象用 Quit 方法关闭 Excel。
ExcelSheet.Application.Quit();//
150.根据标签获得一组对象
var coll = document.all.tags("DIV");
if (coll!=null)
{
for (i=0; i
...
}//
151.实现打印预览及打印
//
152.不通过form,直接通过名字引用对象
//
153.使鼠标滚轮失效
function document.onmousewheel()
{
return false;
}//
154.创建弹出窗口
//
155.取得鼠标所在处的对象
var obj = document.elementFromPoint(event.x,event.y);//
156.获得左边的对象
onclick="this.previousSibling.value='guoguo'">//
157.定位鼠标
document.all.hint_layer.style.left = event.x+document.body.scrollLeft+10;
document.all.hint_layer.style.top = event.y+document.body.scrollTop+10;//
158.向下拉框指定位置添加项目
var op = document.creat