JavaScript windows and Frames

Source: Internet
Author: User
Tags define
Javascript

54 Change Browser status bar text hint
1<script language= "JavaScript" >
2 Window.status = "A new status message";
3</script>
55 Pop-up confirmation Prompt box
1<script language= "JavaScript" >
2 var userchoice = window.confirm ("Click OK or Cancel");
3 if (Userchoice) {
4 document.write ("You chose OK");
5} else {
6 document.write ("You chose Cancel");
7}
8</script>
56 Prompt input
1<script language= "JavaScript" >
2 var userName = window.prompt ("Please enter Your name", "Enter Your name");
3 document.write ("Your Name is" + userName);
4</script>
57 Open a new window
1//opens a new browser window called Mynewwindow
2<script language= "JavaScript" >
3 window.open ("http://www.xrss.cn", "Mynewwindow");
4</script>
58 set the size of the new window
1<script language= "JavaScript" >
2 window.open ("http://www.xrss.cn", "Mynewwindow", ' height=300,width=300 ');
3</script>
59 Set the location of the new window
1<script language= "JavaScript" >
2 window.open ("http://www.xrss.cn", "Mynewwindow", ' height=300,width=300,left=200,screenx=200,top=100,screeny= 100 ');
3</script>
60 show toolbars and scroll bars
1<script language= "JavaScript" >
2 window.open (http://www.xrss.cn "," Mynewwindow "," Toolbar=no, Scrollbars=no, ");
3</script>

61 whether the new window size can be scaled
1<script language= "JavaScript" >
2 window.open (' http://www.xrss.cn ', ' Mynewwindow ', ' resizable=yes ');
3</script>
62 load a new document into the current window
1<a href= ' # '); " >open a Full-screen window</a>
65 actions for new windows and parent windows
1<script language= "JavaScript" >
2//Define a new window
3 var NewWindow = window.open ("128a.html", "NewWindow");
4 Newwindow.close (); Close a new open window in a parent window
5</script>
6
7 Close the parent window in a new window
8window.opener.close ()
66 writing to the new window
1<script language= "JavaScript" >
2 var NewWindow = window.open ("", "NewWindow");
3 NewWindow.document.open ();
4 NewWindow.document.write ("This is a new window");
5 NewWIndow.document.close ();
6</script>
67 load page to frames page
1<frameset cols= "50%,*" >
2<frame name= "frame1" src= "/" 135a.html "" >
3<frame name= "frame2" src= "/" About:blank "" >
4</frameset>
5 loading pages in frame2 in frame1
6parent.frame2.document.location = "135b.html";
68 Sharing scripts between frames pages
If there is a script in the HTML file in Frame1 1function DoAlert () {
2 Window.alert ("Frame 1 is loaded");
3} So this method can be called in frame2
1<body onload= "Parent.frame1.doAlert ();" >
2 This is frame 2.
3</body>
4
69 Data public
You can define data items in a frames page so that the data can be shared by pages in multiple frames
1<script language= "JavaScript" >
2 var persistentvariable = "This is a persistent value";
3</script>
4<frameset cols= "50%,*" >
5<frame name= "frame1" src= "/" 138a.html "" >
6<frame name= "frame2" src= "/" 138b.html "" >
7</frameset> so you can use variables in both frame1 and frame2 persistentvariable

70 Framework code Base
Based on some of the above ideas, we can use a hidden frame page as a code base for the entire frameset
1<frameset cols= "0,50%,*" >
2<frame name= "Codeframe" src= "/" 140code.html "" >
3<frame name= "frame1" src= "/" 140a.html "" >
4<frame name= "frame2" src= "/" 140b.html "" >
5</frameset>
6



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.