国产丝袜视频一区二区三区大长腿|丁香九月婷婷综合|久久久久久久久大|极品无码人妻视频|青青草中文无码|黄p网站免费观看|欧美性爱精品乱码翘臀|亚洲精品第十一页|91精品久久久久久久久久久久久久|曰曰干夜夜噜

首頁(yè) > 熱門提問(wèn) > 網(wǎng)頁(yè)設(shè)計(jì)url

網(wǎng)頁(yè)設(shè)計(jì)url

提問(wèn)

問(wèn)題
列表

  • 設(shè)計(jì)一個(gè)JAVA程序,下載由URL指定的網(wǎng)頁(yè)的源代碼,找出其中所有的超鏈接。

    查看答案>>

  • 網(wǎng)頁(yè)設(shè)計(jì)中設(shè)置超級(jí)鏈接有哪三種 路徑?

    查看答案>>

  • 網(wǎng)頁(yè)設(shè)計(jì) 萬(wàn)維網(wǎng)有哪三個(gè)基本的組成部分

    查看答案>>

  • 網(wǎng)頁(yè)設(shè)計(jì)固定背景圖的代碼

    查看答案>>

  • 網(wǎng)頁(yè)設(shè)計(jì) 萬(wàn)維網(wǎng)有哪三個(gè)基本的組成部分

    查看答案>>

設(shè)計(jì)一個(gè)JAVA程序,下載由URL指定的網(wǎng)頁(yè)的源代碼,找出其中所有的超鏈接。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.net.HttpURLConnection;import java.net.MalformedURLException;import java.net.URL;import java.util.regex.Matcher;import java.util.regex.Pattern; import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.JTextField; public class HttpViewer extends JFrame {    private JTextField urlInput;    private JTextArea viewArea;     public static void main(String[] args) {        new HttpViewer();    }     public HttpViewer() {        this.setTitle("Http Viewer");        this.setSize(800, 600);        this.setResizable(false);        this.setDefaultCloseOperation(EXIT_ON_CLOSE);        initPanel();        initAction();        this.setVisible(true);    }     // 這個(gè)方法用來(lái)設(shè)置窗口布局    private void initPanel() {        JPanel northPanel = new JPanel();        JLabel urlInputLabel = new JLabel("URL:");        urlInput = new JTextField(60);        northPanel.add(urlInputLabel);        northPanel.add(urlInput);        this.add(northPanel, BorderLayout.NORTH);         JPanel centerPanel = new JPanel();        viewArea = new JTextArea(27, 60);        centerPanel.add(new JScrollPane(viewArea));        this.add(centerPanel);    }     // 這個(gè)方法用來(lái)設(shè)置事件    private void initAction() {        urlInput.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                String text = urlInput.getText();                if (text == null || text.length() == 0) {                    viewArea.setText("您沒(méi)有輸入U(xiǎn)RL");                    return;                }                try {                    URL url = new URL(text);                    String context = getContent(url);                    if (context != null) {                        searchFromText(context);                    }                } catch (MalformedURLException e1) {                    viewArea.setText("您輸入的URL不合法:" + text);                }            }        });    }     private String getContent(URL url) {        StringBuffer builder = new StringBuffer();         int responseCode = -1;        HttpURLConnection con = null;        try {            con = (HttpURLConnection) url.openConnection();            con.setRequestProperty("User-Agent",                    "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");// IE代理進(jìn)行下載            con.setConnectTimeout(60000);            con.setReadTimeout(60000);             // 獲得網(wǎng)頁(yè)返回信息碼            responseCode = con.getResponseCode();             if (responseCode == -1) {                viewArea.setText("連接失敗:" + url.toString());                return null;            }             if (responseCode >= 400) {                viewArea.setText("請(qǐng)求失敗,錯(cuò)誤碼:" + responseCode);                return null;            }             InputStream is = con.getInputStream();            InputStreamReader isr = new InputStreamReader(is);            BufferedReader br = new BufferedReader(isr);             String str = null;            while ((str = br.readLine()) != null)                builder.append(str);            is.close();        } catch (IOException e) {            e.printStackTrace();            viewArea.setText("IOException: " + url.toString());        } finally {            con.disconnect();        }        return builder.toString();    }     private void searchFromText(String context) {        viewArea.setText("查找URL中:\n");        Pattern pattern = Pattern.compile("<a( [^>]+)*>(.*?)</a>");        Matcher matcher = pattern.matcher(context);        while (matcher.find()) {            for (String prop : matcher.group(1).split(" ")) {                int indexOf = prop.indexOf('=');                if (indexOf > 0) {                    if (prop.substring(0, indexOf).equals("href")) {                        String url2 = prop.substring(indexOf + 2, prop.length() - 1);                        viewArea.append(url2 + "\n");                    }                }            }        }    } }
0 有幫助? 展開

網(wǎng)頁(yè)設(shè)計(jì)中設(shè)置超級(jí)鏈接有哪三種 路徑?

1、常見(jiàn)的超鏈接1--http只要在鏈接體外添加代碼,如<a href=http://www.baidu.com>去百度</a>,鼠標(biāo)放在去百度上出現(xiàn)下劃線,下面有百度網(wǎng)址出現(xiàn),點(diǎn)擊變登陸百度主頁(yè)。2、常見(jiàn)的超鏈接2--file只要在鏈接體外添加代碼,如<a href=file:///f/baiduyundownload/an.jpg>本地圖片</a>3、常見(jiàn)的超鏈接3--file只要在鏈接體外添加代碼,如<a href=ftp://192.168.1.1/>進(jìn)入ftp</a>4、常見(jiàn)的超鏈接4--mailto只要在鏈接體外添加代碼,如<a href=mailto:630851303@qq.com>E-MAIL</a>示例中因?yàn)槲译娔X沒(méi)裝郵箱客戶端所以不能打開,只要裝了的電腦都難打開郵箱并跳出寫信給XXXXXXXXXXX@qq.com界面。
0 有幫助? 展開

網(wǎng)頁(yè)設(shè)計(jì) 萬(wàn)維網(wǎng)有哪三個(gè)基本的組成部分

萬(wàn)維網(wǎng)有三個(gè)基本的組成部分 url 用于在 web 上進(jìn)入資源的統(tǒng)一方法和路徑 超文本置標(biāo)語(yǔ)言 html 超文本傳輸協(xié)議 http
0 有幫助? 展開

網(wǎng)頁(yè)設(shè)計(jì)固定背景圖的代碼

在<head>里的stytle里的body{}樣式表里加入 background-attachment:fixed; 這個(gè)就行了 比如說(shuō): <style type="text/css"> <!-- body { background-image: url(1280imago001.jpg); background-repeat:no-repeat;background-attachment:fixed; } --> </style> 你試下
0 有幫助? 展開

網(wǎng)頁(yè)設(shè)計(jì) 萬(wàn)維網(wǎng)有哪三個(gè)基本的組成部分

萬(wàn)維網(wǎng)有三個(gè)基本的組成部分 url 用于在 web 上進(jìn)入資源的統(tǒng)一方法和路徑 超文本置標(biāo)語(yǔ)言 html 超文本傳輸協(xié)議 http
0 有幫助 展開
img

在線咨詢

建站在線咨詢

img

微信咨詢

掃一掃添加
動(dòng)力姐姐微信

img
img

TOP