function bodyOnClick() {
alert("2012");
alert("快来吧");
}
function f1() {
window.alert('f1');
}
function f2() {
alert("f2");
}
function confirmDemo() {
if (confirm("确定删除")) {
alert("ok");
}else{
alert("cancel");
}
}
navigate导航 setinterval定时器
<script type="text/javascript">
function transfer() {
window.navigate("1-事件.htm");
}
var tid = window.setInterval("alert('hello')", 500);
</script>
标题跑马灯
function scroll() {
var title = window.document.title;
if (dir == "left") {
var first = title.charAt(0); //截取第一个字符串
var last = title.substring(1, title.length); //截取除第一个字符的所有字符串
} else if (dir == "right") {
var last = title.charAt(title.length - 1);
var first = title.substring(0, title.length - 1);
}
window.document.title = last + first;
}
var i = setInterval("scroll()", 500);
//设置左右
function setDir(str) {
dir = str;
}
window.showModalDialog("1-.htm");
function showDialog() {
window.showModalDialog("1-.htm");
}
function show() {
window.showModelessDialog("1-.htm");
}
<input type="button" value="模式窗口" οnclick="showDialog()" />
<input type="button" value="非模式窗口" οnclick="show()" />