Results 1 to 6 of 6

Thread: [RESOLVED] help with text in java

  1. #1
    New Member
    Join Date
    Oct 12
    Posts
    3

    Resolved [RESOLVED] help with text in java

    Hi I have searched this in a few forums with no luck.

    I am using a java script for day and time, what I am trying to do is change the color and to bold the text of that script.
    I did try using css

    Code:
    <span id="date_time">
                <script type="text/javascript">window.onload = date_time('date_time');</script>\
                </span>
    but no luck with that idea.

    Can anyone steer me in the correct direction?

    Thanks!

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,793

    Re: help with text in java

    First things first, Java and JavaScript are two different things and have basically nothing to do with each other.

    As for your code, does that code actually end up displaying the current date and time within that span? I'm far from a JavaScript expert but, at first glance, I wouldn't have thought so.

    As for bolding the text, how exactly did you try using CSS? Did you put a style attribute on the span? All else failing, would you not be able to simply put the <span> inside a <b>?

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 02
    Location
    Bristol, UK
    Posts
    35,562

    Re: help with text in java

    Welcome to VBForums

    Thread moved from the 'Java' forum to the 'XML, HTML, Javascript, Web and CSS' forum

  4. #4
    New Member
    Join Date
    Oct 12
    Posts
    3

    Re: help with text in java

    I think I mean Javascript... sorry javascript, Java and Css is all fairly new to me, and I was not very clear with my description.

    I do have a .js file with all the main part of the javascript for the date and time, I then have the link portion of code in the head of my page and finally the code (posted above) in the body.
    I then have the same for Css being, main .css file, link in the head and then where required throughout the body.

    The date and time do appear just fine on all the pages they were meant to, I am just trying to adjust the font color and bold it due to some different backgrounds.

    Just guessing and testing, I thought that I would be able to achieve this at the point of placement in the body tags by attaching a Css command to it.

    I hope this makes things a little more clear.

    Thanks again for any and all help. (I am now going to go and read up on the difference between Java and Javascript).

  5. #5
    Super Moderator Joacim Andersson's Avatar
    Join Date
    Jan 99
    Location
    Sweden
    Posts
    13,428

    Re: help with text in java

    The color and font style should be defined in the CSS file. You have given the span an ID of "date_time" so if you want special formatting for anything with that ID you must define that in the CSS file like this:
    Code:
    #date_time
    {
      font-weight: bold;
      color: red;
    }
    Joacim Andersson
    Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
    If anyone's answer has helped you, please show your appreciation by rating that answer.
    I'd rather run ScriptBrix...
    Joacim's view on stuff.

  6. #6
    New Member
    Join Date
    Oct 12
    Posts
    3

    Smile Re: help with text in java

    Ahhh, thank you!

    This is what I had;

    Code:
    date_time		{	font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif;
    				color:#C00;
    				font-weight:bold	
    			}
    I missed the # sign.

    Thanks so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •