In an HTML file I want to look for a series of text inputs and have it replaced with other inputs
So this is for an idea for fun joke-page, for a few friends, but I can't seem to get any code to work. I basically want to take a well known webpage and create a script that will search through out and replace certain words or phrases with others.. So for example, say, every time the word dog is on the webpage-- I want it replaced with hat... or every time "..." is on the page, it would be replaced with "!!!"--- as just an example.
H开发者_运维问答ow would I go about this?
Thanks
You could insert a bit of javascript in the body of your page to search and replace specific words:
<script>
input = 'dog';
output='hat';
document.body.innerHTML = document.body.innerHTML.replace(input,output);
</script>
Example
精彩评论