网页中的输入框神秘消失脚本
作者:admin 日期:2006-07-29
输入框神秘消失脚本说明:
把如下代码加入<body>区域中:
<SCRIPT>
if (document.layers) {
document.writeln ('<STYLE>');
document.writeln (' .changeable { position: relative; }');
document.writeln ('<\/STYLE>');
}
</SCRIPT>
<SCRIPT>
function setElement (id, html) {
if (document.layers) {
var l = document[id];
if (!l.overLayer) {
l.overLayer = new Layer(l.clip.width);
l.overLayer.left = l.pageX;
l.overLayer.top = l.pageY;
l.visibility = 'hide';
l.overLayer.visibility = 'show';
}
l.overLayer.document.open();
l.overLayer.document.write(html);
l.overLayer.document.close();
}
else if (document.all) {
document.all[id].innerHTML = html;
}
}
function changeNow() {
var user = document.aForm.user.value
document.aForm.aField.value = "Welcome "+user+"";
setElement ('someParagraph', document.aForm.aField.value);
}
var nw = "'";
document.write('<FORM NAME="aForm">');
document.write('<INPUT TYPE="hidden" NAME="aField" VALUE="">');
document.write('<SPAN ID="someParagraph" CLASS="changeable">');
document.write('<input type=text name=user size=5> <INPUT TYPE="button" VALUE="ok" ONCLICK="changeNow();">');
document.write('</SPAN></form>');
</SCRIPT>
把如下代码加入<body>区域中:
<SCRIPT>
if (document.layers) {
document.writeln ('<STYLE>');
document.writeln (' .changeable { position: relative; }');
document.writeln ('<\/STYLE>');
}
</SCRIPT>
<SCRIPT>
function setElement (id, html) {
if (document.layers) {
var l = document[id];
if (!l.overLayer) {
l.overLayer = new Layer(l.clip.width);
l.overLayer.left = l.pageX;
l.overLayer.top = l.pageY;
l.visibility = 'hide';
l.overLayer.visibility = 'show';
}
l.overLayer.document.open();
l.overLayer.document.write(html);
l.overLayer.document.close();
}
else if (document.all) {
document.all[id].innerHTML = html;
}
}
function changeNow() {
var user = document.aForm.user.value
document.aForm.aField.value = "Welcome "+user+"";
setElement ('someParagraph', document.aForm.aField.value);
}
var nw = "'";
document.write('<FORM NAME="aForm">');
document.write('<INPUT TYPE="hidden" NAME="aField" VALUE="">');
document.write('<SPAN ID="someParagraph" CLASS="changeable">');
document.write('<input type=text name=user size=5> <INPUT TYPE="button" VALUE="ok" ONCLICK="changeNow();">');
document.write('</SPAN></form>');
</SCRIPT>
评论: 0 | 引用: 70 | 查看次数: 2510
发表评论