当前位置: 首页 > 图文教程 > 网络编程 > Javascript > Javascript实例教程(14) 鼠标触发窗口

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript实例教程(14) 鼠标触发窗口


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-10   浏览: 375 ::
收藏到网摘: n/a

利用Javascript产生鼠标移过时弹出窗口

本节教程将介绍当鼠标移过图片的时候弹出一个窗口的设计。这个弹出的窗口是一个标准的网页,你可以设置它的大小。

首先在网页的Header标签处加入以下代码:

<SCRIPT LANGUAGE="Javascript">

var popupwindow_window = null;

function popupwindow(status,url) {

if(status != 0) {

if(popupwindow != null) popupwindow.focus();

else {

var popupwindow = open(url, "popupwindow", "width=350,height=225");

//这里设置弹出窗口的大小,宽度为350,高度为225.

popupwindow_window = popupwindow;

}

} else {

if(popupwindow_window != null) popupwindow_window.close();

}

}

</SCRIPT>

那如何调用这个JavaScript脚本呢?具体代码如下:

This is your link <A HREF="" onMouseover="popupwindow(1,'popupwindow.html')"

onMouseout="popupwindow(0)"><img src="/images/picture.gif"

hspace=0 vspace=0 border=0 alt="Network"></A>

这样你只要将鼠标移过图片picture.gif的时候,就会弹出一个宽度为350,高度为225的网页了。

点击此处去测试效果页面