top/parent/FrameSet/Frame/iFrame
document.write();
<script>
中间的代码如果不在function里面,会直接执行,在里面可以干很多事情
</script>
页面跳转:
onUnload/onload
reload
JS类:
var variable = new ClassName();
JS内置类或自己写好的框架的类
window.alert()
window.location
window.confirm()
window.open()
获取内容
getElementById
getElementsByName
getElementsById
获取表单下拉列表类型值:
<select name="condition">
<option name="issueTime">***</option>
</select>
document.formName或者document.getElementsByName("formName")[0]
document.formName.condition.value
document.formName.condition.options[1].value
//转帖一个别人的代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script>
function getT(){
var dtd=document.getElementById("dtd");
alert(dtd.option[dtd.options.selectedIndex].value);//需要设置option的值
alert(dtd.options[dtd.options.selectedIndex].innerHTML);//获得option的显示值
}
</script>
</head>
<body>
<select id="dtd" οnchange="getT();">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</body>
</html>
document.write();
<script>
中间的代码如果不在function里面,会直接执行,在里面可以干很多事情
</script>
页面跳转:
onUnload/onload
reload
JS类:
var variable = new ClassName();
JS内置类或自己写好的框架的类
window.alert()
window.location
window.confirm()
window.open()
获取内容
getElementById
getElementsByName
getElementsById
获取表单下拉列表类型值:
<select name="condition">
<option name="issueTime">***</option>
</select>
document.formName或者document.getElementsByName("formName")[0]
document.formName.condition.value
document.formName.condition.options[1].value
//转帖一个别人的代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script>
function getT(){
var dtd=document.getElementById("dtd");
alert(dtd.option[dtd.options.selectedIndex].value);//需要设置option的值
alert(dtd.options[dtd.options.selectedIndex].innerHTML);//获得option的显示值
}
</script>
</head>
<body>
<select id="dtd" οnchange="getT();">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</body>
</html>