473,413 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

extract CSS code from a HTML document

Hello everybody,

I want to print the all the code written between <style></style> element on click a button. Is it possible?? if yes can any body guide me regarding.

thanks for your responses in advance.
Apr 9 '08 #1
3 3763
acoder
16,027 Expert Mod 8TB
If it's just the CSS code between the style tags that you want and not other CSS, here's a quick way:
Expand|Select|Wrap|Line Numbers
  1. // assuming one style tag:
  2. document.getElementsByTagName("style")[0].innerHTML
Apr 9 '08 #2
If it's just the CSS code between the style tags that you want and not other CSS, here's a quick way:
Expand|Select|Wrap|Line Numbers
  1. // assuming one style tag:
  2. document.getElementsByTagName("style")[0].innerHTML
Thnks Acoder. Its working fine. But what will be the line for extracting all the code between the body tag. IF I m writting like this
[HTML]document.getElementsByTagName("body")[0].innerHTML[/HTML].
Its showing me the HTML Preview. But What to get its html code.

Again Thanks very much Acoder for your right time help.
Apr 11 '08 #3
acoder
16,027 Expert Mod 8TB
That should give you the HTML code unless you're setting the innerHTML of another element with it. Set the value of a textarea instead.
Apr 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Casper B | last post by:
As the topic says, I am wondering how (in Java) I can extract a sub-tree of a org.w3c.dom.Document and form a brand new one. I use Oracle's XMLDocument implementation and have been playing around...
3
by: Fendi Baba | last post by:
I am trying to write a simple Javascript code to pass value from a listbox to another field the following is my code f=document.forms; window.alert(f.FieldList.options.length)...
6
by: Selen | last post by:
I would like to be able to extract a BLOB from the database (SqlServer) and pass it to a browser without writing it to a file. (The BLOB's are word doc's, MS project doc's, and Excel spreadsheets....
3
by: Adam Faulkner via DotNetMonster.com | last post by:
I want to create a method within a class that opens a Microsoft Word 2000 Document and has the facility to Create a new word document and then extract a Page that exists within the original Word...
9
by: chrisspencer02 | last post by:
I am looking for a method to extract the links embedded within the Javascript in a web page: an ActiveX component, or example code in C++/Pascal/etc. I am looking for a general solution, not one...
4
by: seberino | last post by:
I'm trying to extract some data from an XHTML Transitional web page. What is best way to do this? xml.dom.minidom.parseString("text of web page") gives errors about it not being well formed...
0
by: Rama Jayapal | last post by:
I am pretty new to VB, so please forgive the simplistic question. This is using VB .NET 2005 My form has three objects on it: a TextBox named URL, a Button named Extract and a WebBrowser named...
0
by: ayyanarj | last post by:
Hi, I have a word document that has attached(ie. embedded ) documents like word, ppt, pdf, etc. I have to extract those embedded documents in the document through code. To extract...
0
by: Formula | last post by:
Hello everybody,because I am newbie in python two weeks only but I had programming in another languages but the python take my heart there's 3 kind of arrays Wow now I hate JAVA :) . I am working...
5
by: Steve | last post by:
Hi all Does anybody please know a way to extract an Image from a pdf file and save it as a TIFF? I have used a scanner to scan documents which are then placed on a server, but I need to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.