1

I have a hotline.txt file, and I want the content to be display in the webpage, the problem is I don't know how to change the font of the hotline.txt content. I use html to display the content of hotline.txt.

Here is my code:

<object class="contact-num" data="S:\IT\Public\Reporting\Intranet\Hotline\Hotline Guide.txt"></object>

2 Answers2

1

You can use CSS to change the style. If you want it to be on the same line, you can do:

<object class="contact-num" data="S:\IT\Public\Reporting\Intranet\Hotline\Hotline Guide.txt" style="font-family: Comic Sans MS"></object>

Or, for better code reading, you can put it on the style mark on head or link an external CSS stylesheet.

/*====================
---On <head></head>---
======================*/
<style>
.contact-num{
    font-family: Arial;
}
</style>
/*==========================================================================================
---On the archive corresponding to <link rel="stylesheet" type="text/css" href="url.css">---
============================================================================================*/
.contact-num{
    font-family: Arial;
}
jaruro2810
  • 13
  • 4
0

You can't style elements outside of the current document boundaries.

You can however load the .txt file with ajax to add it to the document and style it. Below an example of ajax usage using jQuery:

$(function(){
  $.ajax({
    url: "pathToYourFile",
    async: true,
    dataType: "text",
    success: function( data, textStatus, jqXHR ) {
        var resourceContent = data; // can be a global variable too...
        // process the content...
    }
  });
});

Further documentation on ajax: http://api.jquery.com/jquery.ajax/

Thomas Scheffer
  • 524
  • 4
  • 7