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 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.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!