JS Memo--Child parent page Get element properties, display time

Source: Internet
Author: User
Tags getdate

//execute after page load is complete$(function() {gethw ();}); //triggered when the user changes the size of the browser$ (window). Resize (function() {sethw ();}); //Run once every 500 millisecondsWindow.setinterval ("Geth ()", 500);//gets the height of the page and passes it to the element of the parent pagefunctionGetsubpageh () {varParentworkdiv = $ ("#workDiv", parent.document);//Work Area Div    varParentleftdiv = $ ("#leftDiv", parent.document);//left menu Div    varParenttopdiv = $ ("#topDiv", parent.document);//Top Div    varParentbotdiv = $ ("#bottomDiv", parent.document);//Bottom Div    varParentmiddiv = $ ("#middleDiv", parent.document);//Middle Div    varThisbody = $ ("body");//this page    varParentheight = $ ("Body", parent.document). Height ();//Parent page Available height    varParentwidth = $ ("Body", parent.document). width ();//Parent Page Available width    if((Thisbody.height () < Parentheight) && (Parentleftdiv.height () <parentheight)) {Parentmiddiv.height (Parentheight-Parenttopdiv.height ()-parentbotdiv.height ()); }    Else {        if(Thisbody.height () >parentleftdiv.height ())        {Parentmiddiv.height (Thisbody.height ()); }        Else{parentmiddiv.height (Parentleftdiv.height ()); }} parentworkdiv.width (Parentwidth-Parentleftdiv.width ());//Set Width//alert (parentmiddiv.height () + "-" + parentheight);}//set the width of the page's work areafunctionsethw () {varLeftdiv = $ ("#leftDiv"); varWorkdiv = $ ("#workDiv"); //get the width of the browser    varHtmlwidth =$ (document). width (); varW = htmlwidth-leftdiv.width (); Workdiv.width (w);}//Show Current TimefunctionShowTime () {//Get Current date    varDateTime =NewDate (); varDatestr; //Define Week    varWeek = "Week"; varDayWeek =NewArray ("Day", "one", "two", "three", "four", "five", "six"); Week+ = Dayweek[datetime.getday () + 1]; //yearsDatestr = datetime.getfullyear () + "year"; //Month    if(Datetime.getmonth () < 10) {Datestr+ = "0"; } datestr+ = (Datetime.getmonth () + 1) + "Month"; //Day    if(Datetime.getdate () < 10) {Datestr+ = "0"; } datestr+ = Datetime.getdate () + "Day &nbsp;&nbsp;" + Week + "&nbsp;&nbsp;"; //when    if(Datetime.gethours () < 10) {Datestr+ = "0"; } datestr+ = Datetime.gethours () + ":"; //points    if(Datetime.getminutes () < 10) {Datestr+ = "0"; } datestr+ = Datetime.getminutes () + ":"; //seconds    if(Datetime.getseconds () < 10) {Datestr+ = "0"; } datestr+=datetime.getseconds (); document.getElementById ("Lbltime"). InnerHTML =datestr;}

JS Memo--Child parent page Get element properties, display time

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.