Some simple Javascript

Source: Internet
Author: User
A time-based clock function show ()
{If (! Document. Layers &&! Document. All)
Return

VaR digital = new date ()
VaR year = digital. getyear ()
VaR month = digital. getmonth () + 1
VaR day = digital. getdate ()
VaR hours = digital. gethours ()
VaR minutes = digital. getminutes ()
VaR seconds = digital. getseconds ()
VaR DN = "am"
If (hours> 12) {DN = "PM"
Hours = hours-12
} If (hours = 0)
Hours = 12
If (minutes <= 9)
Minutes = "0" + minutes
If (seconds <= 9)
Seconds = "0" + seconds
// Change font size here to your desire
Myclock = "<font color = blue>" + year + "-" + month + "-" + day + "+ hours +": "+ minutes + ": "+ seconds +" "+ DN +" </font> ";
If (document. layers ){
Document.layers.liveclock.doc ument. Write (myclock)
Document.layers.liveclock.doc ument. Close ()
} Else if (document. All)
Jnkc. innerhtml = myclock
SetTimeout ("show ()", 1000)
}
// -->
Window. onload = show;

Click <SCRIPT type = "text/JavaScript">
Function submitkeyclick (button)
{
If (event. keycode = 13)
{
Event. keycode = 9;
Event. returnvalue = false;
Document. All [button]. Click ();
}
}
</SCRIPT>

During the call, you can write it like this (after the user loses the password, press Enter) me.txt pass. Attributes. Add ("onkeydown", "submitkeyclick ('button1 ');")

Button1 is the button to press enter to execute

Maximize page initial time

<Script language = "JavaScript">
Self. moveTo (0, 0)
Self. resizeTo (screen. availwidth, screen. availheight)
</SCRIPT>

The default value is displayed in the text box. After clicking the button, the value becomes null. <SCRIPT type = "text/JavaScript">
Function cleartxt (textboxid)
{

If (textboxid = "textbox1" & document. All (textboxid). value = "Please input keyword ")
Document. All (textboxid). value = "";
}

</SCRIPT>

Write me. textbox1.attributes. Add ("onclick", "cleartxt ('textbox1');") in the background ');")

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.