


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 我在搜狐上查詢了三只股票的數(shù)據(jù),網(wǎng)址如下:
http://q.stock.sohu.com/cn/msq.shtml?q=cn_000022,cn_600019,cn_600028
打開(kāi)網(wǎng)頁(yè)之后,能看到一個(gè)表格,它的數(shù)據(jù)復(fù)制下來(lái)就是如下內(nèi)容:
=======內(nèi)容開(kāi)始===========================================================
股票代碼?股票名稱?當(dāng)前價(jià)?漲跌額?漲跌幅?總手?現(xiàn)手?成交金額?換手率?今低-今高?今開(kāi)盤(pán)?昨收盤(pán)?
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?中國(guó)石化?7.01?-0.06?-0.85%?244512?47?17029?0.03%?6.90-7.02?6.97?7.07?
=======內(nèi)容結(jié)束===========================================================
如果我察看該網(wǎng)頁(yè)的源代碼,發(fā)現(xiàn)這一塊相應(yīng)的代碼是:
=======代碼片段開(kāi)始===========================================================
股票代碼 | 股票名稱 | 當(dāng)前價(jià) | 漲跌額 | 漲跌幅 | 總手 | 現(xiàn)手 | 成交金額 | 換手率 | 今低-今高 | 今開(kāi)盤(pán) | 昨收盤(pán) |
---|---|---|---|---|---|---|---|---|---|---|---|
=======代碼片段結(jié)束===========================================================
我的問(wèn)題是為什么看不到“寶鋼股份”、“600019”、“中國(guó)石化”這樣字樣?我當(dāng)初學(xué)習(xí)html的時(shí)候,不是說(shuō)網(wǎng)頁(yè)上顯示的東西都能在源代碼中找到么?搜狐它這個(gè)網(wǎng)頁(yè)為什么從源代碼中找不到?
另外,如果用另存為的辦法將網(wǎng)頁(yè)保存到本地,也會(huì)發(fā)現(xiàn)三行股票數(shù)據(jù)消失,只剩下表格頭:
=======保存到本地文件后觀察到的內(nèi)容開(kāi)始===========================================================
股票代碼?股票名稱?當(dāng)前價(jià)?漲跌額?漲跌幅?總手?現(xiàn)手?成交金額?換手率?今低-今高?今開(kāi)盤(pán)?昨收盤(pán)?
=======保存到本地文件后觀察到的內(nèi)容結(jié)束===========================================================
為什么會(huì)出現(xiàn)這樣的現(xiàn)象呢?
???????????
回復(fù)討論(解決方案)
估計(jì)這些數(shù)據(jù)通過(guò)AJAX異步獲取的。
我其實(shí)對(duì)如何獲取那三行股票數(shù)據(jù)有興趣,不知道搜狐這個(gè)頁(yè)面用來(lái)獲取數(shù)據(jù)的代碼是不是藏在這個(gè)頁(yè)面中?有高手請(qǐng)進(jìn)來(lái)指導(dǎo)一下哦。
源代碼指顯示后臺(tái)response過(guò)來(lái)的
JS打印的,包括AJAX的,是木有、
看這個(gè)JS文件
謝謝KongHuLu兄,這個(gè)js文件暫時(shí)看不太懂。咱們有木有什么辦法通過(guò)調(diào)用這個(gè)js文件從自己的local服務(wù)器上搞一個(gè)網(wǎng)頁(yè)來(lái)得到相同的數(shù)據(jù)?
或者說(shuō),如何用vba把這3行數(shù)據(jù)抓到excel或者access當(dāng)中來(lái)???
學(xué)一下AJAX就明白了。保存什么的,就是保存頁(yè)面的源碼,不包括頁(yè)面邏輯執(zhí)行后的結(jié)果。
學(xué)明白AJAX就知道如何利用了,很簡(jiǎn)單。
謝謝,我學(xué)學(xué)去。
為了加快學(xué)習(xí)進(jìn)度,theforever兄能否給個(gè)簡(jiǎn)單的例子?比如用excel的vba代碼獲取哪怕一個(gè)開(kāi)盤(pán)價(jià),剩下的我再慢慢學(xué)。
謝謝,我學(xué)學(xué)去。
為了加快學(xué)習(xí)進(jìn)度,theforever兄能否給個(gè)簡(jiǎn)單的例子?比如用excel的vba代碼獲取哪怕一個(gè)開(kāi)盤(pán)價(jià),剩下的我再慢慢學(xué)。 你的問(wèn)題解決沒(méi)有能不能給點(diǎn)意見(jiàn)?
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.

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The key to keep up with HTML standards and best practices is to do it intentionally rather than follow it blindly. First, follow the summary or update logs of official sources such as WHATWG and W3C, understand new tags (such as) and attributes, and use them as references to solve difficult problems; second, subscribe to trusted web development newsletters and blogs, spend 10-15 minutes a week to browse updates, focus on actual use cases rather than just collecting articles; second, use developer tools and linters such as HTMLHint to optimize the code structure through instant feedback; finally, interact with the developer community, share experiences and learn other people's practical skills, so as to continuously improve HTML skills.

The reason for using tags is to improve the semantic structure and accessibility of web pages, make it easier for screen readers and search engines to understand page content, and allow users to quickly jump to core content. Here are the key points: 1. Each page should contain only one element; 2. It should not include content that is repeated across pages (such as sidebars or footers); 3. It can be used in conjunction with ARIA properties to enhance accessibility. Usually located after and before, it is used to wrap unique page content, such as articles, forms or product details, and should be avoided in, or in; to improve accessibility, aria-labeledby or aria-label can be used to clearly identify parts.

To create a basic HTML document, you first need to understand its basic structure and write code in a standard format. 1. Use the declaration document type at the beginning; 2. Use the tag to wrap the entire content; 3. Include and two main parts in it, which are used to store metadata such as titles, style sheet links, etc., and include user-visible content such as titles, paragraphs, pictures and links; 4. Save the file in .html format and open the viewing effect in the browser; 5. Then you can gradually add more elements to enrich the page content. Follow these steps to quickly build a basic web page.

To create an HTML checkbox, use the type attribute to set the element of the checkbox. 1. The basic structure includes id, name and label tags to ensure that clicking text can switch options; 2. Multiple related check boxes should use the same name but different values, and wrap them with fieldset to improve accessibility; 3. Hide native controls when customizing styles and use CSS to design alternative elements while maintaining the complete functions; 4. Ensure availability, pair labels, support keyboard navigation, and avoid relying on only visual prompts. The above steps can help developers correctly implement checkbox components that have both functional and aesthetics.

To reduce the size of HTML files, you need to clean up redundant code, compress content, and optimize structure. 1. Delete unused tags, comments and extra blanks to reduce volume; 2. Move inline CSS and JavaScript to external files and merge multiple scripts or style blocks; 3. Simplify label syntax without affecting parsing, such as omitting optional closed tags or using short attributes; 4. After cleaning, enable server-side compression technologies such as Gzip or Brotli to further reduce the transmission volume. These steps can significantly improve page loading performance without sacrificing functionality.

It is a semantic tag used in HTML5 to define the bottom of the page or content block, usually including copyright information, contact information or navigation links; it can be placed at the bottom of the page or nested in, etc. tags as the end of the block; when using it, you should pay attention to avoid repeated abuse and irrelevant content.

HTMLhasevolvedsignificantlysinceitscreationtomeetthegrowingdemandsofwebdevelopersandusers.Initiallyasimplemarkuplanguageforsharingdocuments,ithasundergonemajorupdates,includingHTML2.0,whichintroducedforms;HTML3.x,whichaddedvisualenhancementsandlayout

ThetabindexattributecontrolshowelementsreceivefocusviatheTabkey,withthreemainvalues:tabindex="0"addsanelementtothenaturaltaborder,tabindex="-1"allowsprogrammaticfocusonly,andtabindex="n"(positivenumber)setsacustomtabbing
