當前位置:生活全書館 >

綜合知識

> 彈出框怎麼寫

彈出框怎麼寫

1. 菜鳥求助:長按螢幕彈出提示框的程式碼怎麼寫

(說明:屬性設定視窗預設在螢幕右側)

彈出框怎麼寫

1.視窗名稱:單擊窗體,更改窗體的Caption屬性。

視窗的小圖示:單擊窗體,設定窗體的Icon屬性。

生成可執行檔案的圖示等詳細資訊:點選單“工程 - 工程1 屬性”,但後選“生成”選項卡,在裡面設定。

2.單擊輸入框,把Appearance屬性改為0。

3.透明的?VB自帶的按鈕控制元件不能設定為透明……你的意思是要在程式執行的時候不顯示該按鈕嗎?單擊按鈕,把Visible屬性改為False。

4.粗略控制:在右下角的“窗體佈局”視窗中拖動你的窗體到合適的位置即可。

精確控制:單擊窗體,設定窗體的StartUpPosition屬性。

5.你的意思是去掉Windows風格的邊框嗎?單擊窗體,把BorderStyle屬性改為0。

6.請先自行設定“提示性文字”,即輸入框的Text屬性,然後雙擊輸入框跳轉到程式碼編輯視窗。往上看,你會看到兩個下拉選單,左面的是“物件”,顯示Text1;右面的是“過程”,顯示Change。單擊“過程”下拉選單,選擇GotFocus過程,輸入如下程式碼:(假設你的輸入框名稱為Text1)

Text1.Text = ""

在Click事件裡寫是不準確的,當按Tab鍵使輸入框獲得焦點的時候是無效的。

以上內容全部原創,希望能夠幫得到你,也請後回答者不要抄襲。

2. 彈出視窗的html的程式碼是怎麼寫的

1、最基本的彈出視窗程式碼

< SCRIPT LANGUAGE="javascript">

< !--

window.open ("page.html")

-- >

< /SCRIPT>

window.open ("page.html") 用於控制彈出新的視窗page.html,如果page.html不與主視窗在同一路徑下,前面應寫明路徑,絕對路徑(", "newwindow", "height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")

->

< /SCRIPT>

< SCRIPT LANGUAGE="javascript"> js指令碼開始;window.open 彈出新視窗的命令;"page.html" 彈出視窗的檔名;"newwindow" 彈出視窗的名字(不是檔名),非必須,可用空"代替;

3、用函式控制彈出視窗

< script LANGUAGE="JavaScript">

< !--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

-->

< /script>

這裡定義了一個函式openwin(),函式內容就是開啟一個視窗。

4、同時彈出2個視窗

< script LANGUAGE="JavaScript">

< !--

function openwin() {

window.open ("page.html", "newwindow", "height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

window.open ("page2.html", "newwindow2", "height=100, width=100, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

-->

< /script>

為避免彈出的2個視窗覆蓋,用top和left控制一下彈出的位置不要相互覆蓋即可。

5、主視窗開啟檔案1.htm,同時彈出小視窗page.html

< script language="javascript">

< !--

function openwin() {

window.open("page.html","","width=200,height=200")

}

-->

< /script>

3. android訊息彈出框怎麼寫

AlertDialog的構造方法全部是Protected的,所以不能直接通過new一個AlertDialog來創建出一個AlertDialog。

下面例子來自於android學習手冊,android學習手冊包含9個章節,108個例子,原始碼文件隨便看,例子都是可互動,可執行,原始碼採用android studio目錄結構,高亮顯示程式碼,文件都採用文件結構圖顯示,可以快速定位。360手機助手中下載,圖示上有貝殼要建立一個AlertDialog,就要用到AlertDialog.Builder中的create()方法。

使用AlertDialog.Builder建立對話方塊需要了解以下幾個方法:setTitle :為對話方塊設定標題setIcon :為對話方塊設定圖示setMessage:為對話方塊設定內容setView : 給對話方塊設定自定義樣式setItems :設定對話方塊要顯示的一個list,一般用於顯示幾個命令時setMultiChoiceItems :用來設定對話方塊顯示一系列的複選框setNeutralButton :普通按鈕setPositiveButton :給對話方塊新增"Yes"按鈕setNegativeButton :對話方塊新增"No"按鈕create : 建立對話方塊show :顯示對話方塊一、簡單的AlertDialog下面,建立一個簡單的ALertDialog並顯示它:public class Dialog_AlertDialogDemoActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Dialog alertDialog = new AlertDialog.Builder(this). setTitle("對話方塊的標題"). setMessage("對話方塊的內容"). setIcon(R.drawable.ic_launcher). create(); alertDialog.show(); } } package com.tianjf;import android.app.Activity;import android.app.AlertDialog;import android.app.Dialog;import android.os.Bundle;public class Dialog_AlertDialogDemoActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Dialog alertDialog = new AlertDialog.Builder(this). setTitle("對話方塊的標題"). setMessage("對話方塊的內容"). setIcon(R.drawable.ic_launcher). create(); alertDialog.show(); }}執行結果如下:二、帶按鈕的AlertDialog上面的例子很簡單,下面我們在e79fa5e98193e58685e5aeb931333361326235這個AlertDialog上面加幾個Button,實現刪除操作的提示對話方塊[java] package com.tianjf; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; public class Dialog_AlertDialogDemoActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Dialog alertDialog = new AlertDialog.Builder(this). setTitle("確定刪除?"). setMessage("您確定刪除該條資訊嗎?"). setIcon(R.drawable.ic_launcher). setPositiveButton("確定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }). setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }). setNeutralButton("檢視詳情", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }). create(); alertDialog.show(); } } package com.tianjf;import android.app.Activity;import android.app.AlertDialog;import android.app.Dialog;import android.content.DialogInterface;import android.os.Bundle;public class Dialog_AlertDialogDemoActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Dialog alertDialog = new AlertDialog.Builder(this). setTitle("確定刪除?"). setMessage("您確定刪除該條資訊嗎?"). setIcon(R.drawable.ic_launcher). setPositiveButton("確定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }). setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }). setNeutralButton("檢視詳情", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }). create(); alertDialog.sho。

4. java中要在彈出框中做判斷怎麼寫

import javax.swing.JOptionPane;

public class Test {

public static void main(String[] args) {

int result = JOptionPane.showConfirmDialog(null, "hello");

switch (result) {

case JOptionPane.YES_OPTION:

JOptionPane.showMessageDialog(null, "你選擇了yes");

break;

case JOptionPane.NO_OPTION:

JOptionPane.showMessageDialog(null, "你選擇了no");

break;

case JOptionPane.CANCEL_OPTION:

JOptionPane.showMessageDialog(null, "你選擇了cancel");

break;

default:

JOptionPane.showMessageDialog(null, "你沒選擇");

break;

}

}

}

5. JS彈出對話方塊怎麼寫

【1、最基本的js彈出對話方塊視窗程式碼】這是最基本的js彈出對話方塊,其實程式碼就幾句非常簡單:複製程式碼程式碼如下:因為這是一段javascripts程式碼,所以它們應該放在之間。

<!-- 和-->是對一些版本低的瀏覽器起作用,在這些老瀏覽器中不會將標籤中的程式碼作為文字顯示出來。要養成這個好習慣啊。

window.open ("page.html") 用於控制彈出新的視窗page.html,如果page.html不與主視窗在同一路徑下,前面應寫明路徑,絕對路徑(> <body onl oad="openwin()"> 。

任意的頁面內容。 這裡定義了一個函式openwin(),函式內容就是開啟一個視窗。

在呼叫它之前沒有任何用途。怎麼呼叫呢? 方法一:瀏覽器讀頁面時彈出視窗;複製程式碼程式碼如下:<body onl oad="openwin()"> 方法二:瀏覽器離開頁面時彈出視窗;複製程式碼程式碼如下:<body onunload="openwin()"> 方法三:用一個連線呼叫:複製程式碼程式碼如下:開啟一個視窗 注意:使用的“#”是虛連線。

方法四:用一個按鈕呼叫:複製程式碼程式碼如下:【4、同時彈出2個視窗的js彈出對話方塊】對原始碼稍微改動一下:複製程式碼程式碼如下:View Code為避免彈出的2個視窗覆蓋,用top和left控制一下彈出的位置不要相互覆蓋即可。最後用上面說過的四種方法呼叫即可。

注意:2個js彈出對話方塊視窗的name(newwindows和newwindow2)不要相同,或者乾脆全部為空。【5、主視窗開啟檔案1.htm,同時彈出小視窗page.html】如下程式碼加入主視窗區:複製程式碼程式碼如下:View Code加入<body>區:複製程式碼程式碼如下:open即可。

【6、js彈出對話方塊彈出的視窗之定時關閉控制】下面我們再對js彈出對話方塊的視窗進行一些控制,效果就更好了。如果我們再將一小段程式碼加入彈出的頁面(注意是加入到page.html的HTML中,可不是主頁面中,否則。)

讓它10秒後自動關閉是不是更酷了?首先,將如下程式碼加入page.html檔案的區:複製程式碼程式碼如下: 然後,再用<body onl oad="closeit()"> 這一句話代替page.html中原有的<body>這一句。

標籤: 彈出
  • 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/zonghezhishi/vyny2q.html