search
HomeWeb Front-endHTML TutorialTable 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

我在搜狐上查询了三只股票的数据,网址如下:
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
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
HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

See all articles

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool