strejda google hodil neco takoveho:
<script type="text/javascript">
var visitorName = "Chuck";
var myOldString = "Hello username! I hope you enjoy your stay username.";
var myNewString = myOldString.replace("username", visitorName);
document.write("Old string = " + myOldString);
document.write("New string = " + myNewString);
</script>
pripadne s regularnim vyrazem:
<script type="text/javascript">
var visitorName = "Chuck";
var myOldString = "Hello username! I hope you enjoy your stay username.";
var myNewString = myOldString.replace(/username/, visitorName);
document.write("Old string = " + myOldString);
document.write("New string = " + myNewString);
</script>