/    Sign up×
Community /Pin to ProfileBookmark

How do I change text generated by external html-script?

I am trying to find out how I can grab the output of an external html-script and make some automatic changes before it is published on my website. I dont actually program much of the stuff, since I use a CMS, but it allows me to add javascripts, html-scripts and ASP.

My CMS has no calendar function, but i found a web service, that allows me to create an activity calendar, and import it to my site with a html-script. This works great, but I want to make some changes to the html, this script produces:

a) changing width of the generated table
b) changing color of some specific words (whenever an activity is marked “Cancelled” (or some other stuff) it should be highlighted)

Is this at all possible?

T

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@T_BangauthorDec 02.2004 — I got a solution for changing text from another forum, thought I might pass it on:

First styles for emphasizing text is added:

[CODE]
.alert {color: #f00;}
.time {font-weight: bolder;}
.month {font-size: larger; color: #900;}
[/CODE]


Then this script is added - placed just ahead the script that grabs the input from another URL:

[CODE]
<script type="text/javascript">

var dwrite = document.write; //save reference
document.write = function(str) //over-write
{
str = str.replace(/(udekamp)/gi, '<span class="alert">$1</span>'); //red udekamps, neat
str = str.replace(/(bd{1,2}:d{1,2})/g, '<span class="time">$1</span>'); //strong dates
str = str.replace(/(December)/gi, '<span class="month">$1</span>'); //emphasize month
document.write = dwrite; //restore original
document.write(str); //use it
}

</script>
[/CODE]


Hope others can use this, too

T
×

Success!

Help @T_Bang spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...