Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial Table data can be copied on the web page. Why can't I find this data when I check the source code? _html/css_WEB-ITnose

Table data can be copied on the web page. Why can't I find this data when I check the source code? _html/css_WEB-ITnose

Jun 24, 2016 pm 12:25 PM

我在搜狐上查询了三只股票的数据,网址如下:
http://q.stock.sohu.com/cn/msq.shtml?q=cn_000022,cn_600019,cn_600028
打开网页之后,能看到一个表格,它的数据复制下来就是如下内容:
=======内容开始===========================================================
股票代码 股票名称 当前价 涨跌额 涨跌幅 总手 现手 成交金额 换手率 今低-今高 今开盘 昨收盘 
000022 深赤湾A 11.70 -0.30 -2.50% 8844 86 1034 0.19% 11.60-11.80 11.60 12.00 
600019 宝钢股份 5.17 -0.06 -1.15% 321813 63 16563 0.18% 5.11-5.19 5.15 5.23 
600028 中国石化 7.01 -0.06 -0.85% 244512 47 17029 0.03% 6.90-7.02 6.97 7.07 
=======内容结束===========================================================
如果我察看该网页的源代码,发现这一块相应的代码是:
=======代码片段开始===========================================================


                
                    
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        今低-今高
                        今开盘
                        昨收盘
                    

                    












                    
                


股票代码 股票名称
当前价
涨跌额
涨跌幅
总手
现手
成交金额
换手率

=======代码片段结束===========================================================

我的问题是为什么看不到“宝钢股份”、“600019”、“中国石化”这样字样?我当初学习html的时候,不是说网页上显示的东西都能在源代码中找到么?搜狐它这个网页为什么从源代码中找不到?

另外,如果用另存为的办法将网页保存到本地,也会发现三行股票数据消失,只剩下表格头:
=======保存到本地文件后观察到的内容开始===========================================================
股票代码 股票名称 当前价 涨跌额 涨跌幅 总手 现手 成交金额 换手率 今低-今高 今开盘 昨收盘 
=======保存到本地文件后观察到的内容结束===========================================================

为什么会出现这样的现象呢?
           


回复讨论(解决方案)

估计这些数据通过AJAX异步获取的。

我其实对如何获取那三行股票数据有兴趣,不知道搜狐这个页面用来获取数据的代码是不是藏在这个页面中?有高手请进来指导一下哦。

源代码指显示后台response过来的
JS打印的,包括AJAX的,是木有、

看这个JS文件

谢谢KongHuLu兄,这个js文件暂时看不太懂。咱们有木有什么办法通过调用这个js文件从自己的local服务器上搞一个网页来得到相同的数据?

或者说,如何用vba把这3行数据抓到excel或者access当中来啊?

学一下AJAX就明白了。保存什么的,就是保存页面的源码,不包括页面逻辑执行后的结果。
学明白AJAX就知道如何利用了,很简单。

谢谢,我学学去。
为了加快学习进度,theforever兄能否给个简单的例子?比如用excel的vba代码获取哪怕一个开盘价,剩下的我再慢慢学。

谢谢,我学学去。
为了加快学习进度,theforever兄能否给个简单的例子?比如用excel的vba代码获取哪怕一个开盘价,剩下的我再慢慢学。 你的问题解决没有能不能给点意见?

It should be displayed using js or the like, and there is no static output, so it is not in the source code, it is dynamic!

[Quote=quote 8th floor’s reply:]
Thank you, I will learn from it go.
In order to speed up the learning process, can brother theforever give a simple example? For example, I can use Excel's VBA code to get even an opening price, and I will learn the rest slowly. Can you give me some advice on how to solve your problem?
Sorry, I haven’t researched it yet.

I downloaded a book called Head First Ajax online. I don’t have time to read it yet, so I’ll post it first. Thank you.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles