Replace html text in javascript include

i've got this:

<script type="text/javascript" src=""></script>

in my php/html file. It includes the whole something.js file. In this file, there are lines like with "document.write..." that are writing some text on my page.

Is it possible to replace a string that is included from this js file in my php document? I can't change the js file (I don't have access to it).

More information:

The .js file looks like this:

var msg = '';
msg +='<b>mystring1</b><br/><i>mystring2</i>';

My php file includes the js file. I wanna change the mystring2 to myteststring in PHP. Is this possible? How? Thanks.


You can't do this cleanly.

If the .js file is calling document.write() inline and it doesn't access any external variables or functions you really don't have any control over it. You could perhaps redefine document.write() but that's ugly.

I suggest you either maintain your own copy of that .js file or change the document a second time using another script executed from the window.onload event.

Need Your Help

Parsing Quoted Strings Having Nested Escape Sequences in jsoncpp

c++ json string escaping jsoncpp

I'm using the jsoncpp library here. I am confused by the parsing of single quotation marks (') and double quotation marks (").

How to handle multiple countdown timers in ListView?

android listview countdown baseadapter countdowntimer

I have a listview (with a custom list adapter), I need to display a countdown on every row.