javascript集锦,各个元素说明
javascript集锦
javascript数组操作汇总
javascript动态创建form表单 和 节点控制说明
动态读取
javascript:function ctys(_ctag){
ctys1=document.createElement(_ctag);
document.body.appendChild(ctys1);
return ctys1
};
newE1=ctys('<TEXTAREA id=www>');
newE1.cols='150';
newE1.rows='30';
newE2=ctys('BUTTON');
newE2.value="执行";
newE2.onclick=function(){
eval(document.getElementById("www").value)
};
alert(1)
动态页面控制示例
javascript:document.write(document.getElementsByTagName('body')(0).innerHTML.match(/<SPAN class=fcgray>([\s\S]*?)<\/SPAN>/ig))
javascript:alert(document.getElementById('tab_c_iframe').style.display="none")
javascript:alert(document.getElementsByTagName('body')(0).innerHTML)
javascript:document.write(document.getElementsByTagName('body')(0).innerHTML)
javascript:var ccc=document.createElement("div");ccc.setAttribute("type","text");ccc.setAttribute
("value","11111111111111");ccc.style.marginLeft="8px";ccc.style.marginTop="10px";ccc.style.width="320px"; ccc.style.height="250px"; ccc.style.zIndex="111";
==============
table
tbody
tr
的innerHTML 为只读
td
tr
tbody
的outerHTML 为只读
=========================
javascript技巧:setInterval("Test();",10); // 10秒钟发送一次更新请求防止网页表格被撑大的代码:
style="table-layout:fixed;word-wrap:break-word; word-break;break-all;"”,
vb字符串反向函数:StrReverse,,,
vb字符串自动分成数组:split
vb字符转换函数:StrConv
网页自动最大化代码:
<script language="javascript">
<!--
window.moveTo(0,0)
window.resizeTo(screen.availWidth,screen.availHeight)
if (top.location !== self.location) {
top.location=self.location;
}
//-->
</script>
VB字符串函数:InStrRev(找一个字符串在另一个字符串里最后一次出现的位置,与之相反的是instr)
显示当前网页的更新时间:
javascript:alert(document.lastModified)
读取整个网页内容:
javascript:alert(document.documen
相关文档:
window.onload= someFunction();//页面报尚未实现错误时不防用下面的试一下
window.onload = someFunction;
window.onload = function (){someFunction();};
window.onload = Function("someFunction();"); ......
<html>
<head>
<script language="javascript">
function overlay() {
xyz = document.getElementById("overlay");
&n ......
<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
<title></title>
</head>
<body>
<form id="form1">
<div>
& ......
当需要在网页中显示时间时可以用到下面这段代码:
<SCRIPT language=JavaScript type=text/JavaScript>
var day="";
var month="";
var ampm="";
var ampmhour="";
var myweekday="";
var year="";
mydate=new Date();
myweekday=mydate.getDay();
mymonth=mydate.getMonth()+1;
myday= mydate.getDate(); ......
以下事例为结合本人电脑而设计的参数,您也可改为自己的尺寸
<SCRIPT LANGUAGE="JavaScript">
var chicun;
chicun=screen.width;
if(chicun==1280||chicun==1440||chicun==1600)
{
<!--
function initEcAd() {
document.all.AdLayer1.style.posTop = -100;
document.all.AdLayer1.style.visibility = 'vis ......