4

I get a script from a website to put it into my website, but the font color is not what I want.

The script is:

<script language="javascript" src="http://www.parstools.net/calendar/?type=2"></script>

and now I want to change the font color of it. What should I do?

I would really appreciate your help, thanks.

2 Answers 2

4

Examining the source of that script, it is simply writing an anchor link with document.write():

document.write("<a href='http://www.ParsTools.com/'>1389/1/31</a>");     

You may want to include that script inside a <div>, and then style the anchor links within that <div> using CSS:

<div id="calendar">
   <script src="http://www.parstools.net/calendar/?type=2"></script>
</div>

Then you should also add the following CSS class definition:

div#calendar a {
    color: red;
}

The following is a full example:

<!DOCTYPE html>
<html> 
  <head> 
    <title>Simple Demo</title> 

    <style type="text/css">
       div#calendar a {
          color: red;
       }
    </style>

  </head> 
  <body> 

    <div id="calendar">
       <script src="http://www.parstools.net/calendar/?type=2"></script>
    </div>        

  </body> 
</html>
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for you asnwer Mr. Vassallo, it does work. thanks again.
and one more question about it, actually script works fine, but it has a hyperlink to the source website (parstools.net), how can I disable the hyperlink in it?
@user320946: That is not as easy. You may want to post another question on that.
0

I assume you want to change the font colour of the HTML code produced by the script? If so, just use normal CSS in your external stylesheet and it will apply to the added content.

For example, if you want to make the text inside the element myElement a nice blue colour:

#myElement {
    font-color: #0099FF;
}

If the script is not your own, then you will want to analyse the code produced by it to work out which elements you need to style in order to change the colour of the text. Many external scripts that you embed in your website contain inline CSS rules, meaning that you will have to override many elements in your external CSS stylesheet to change simple things like text colour. You may also have to add !important to the end of your CSS rule in order to override the inline styling:

#myElement {
    font-color: #0099FF !important;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.