Hola buenas tengo un problema devido a que mi hosting cayo todos los links de ese hosting que puse en mi web desaparecieron y como todos son lo mismo
osea esta url: http://www.shareado.com/carlos/pelisflv.php
quisera reemplazar dicha url con una nueva con javascript
osea esta seria la nueva url: http://www.minuevaweb.com/carlos/pelisflv.php
veran buscando encontre un codigo que reemplaza caracteres de texto por un codigo html con javascript
entonces yo pende que si reemplazaba texto porque no tambien urls
bueno intente pero no me sale
aqui el codigo que reemplaza texto por HTML
Código:
//<![CDATA[
document.getElementsByClassName = function(clsName){
var retVal = new Array();
var elements = document.getElementsByTagName("*");
for(var i = 0;i < elements.length;i++){
if(elements[i].className.indexOf(" ") >= 0){
var classes = elements[i].className.split(" ");
for(var j = 0;j < classes.length;j++){
if(classes[j] == clsName)
retVal.push(elements[i]);
}
}
else if(elements[i].className == clsName)
retVal.push(elements[i]);
}
return retVal;
}
function addSmiley(){
var postBodyClass = (postBodyClass) ? postBodyClass : 'post-body';
var d = document.getElementsByClassName(postBodyClass);
for(var i=0;i<d.length;i++){
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\)/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnYLIs-1BI/AAAAAAAAAC8/5wpw7U-ciGk/70bff581.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-S/gi, ' <img src="http://lh5.ggpht.com/_XbQZjvPM5H4/TLnYwZB-psI/AAAAAAAAADA/GwYUo34BpfQ/3c68bb64.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-P/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnaJ7z_7kI/AAAAAAAAADE/HsVd5D39j00/d5f02ecd.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\[/gi, ' <img src="http://lh6.ggpht.com/_XbQZjvPM5H4/TLnaw8ulyhI/AAAAAAAAADI/mE8B4t5ndCM/3.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-D/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLnbHORNqkI/AAAAAAAAADM/EFCA6sxfrig/4412144b.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\}\:\-\]/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLnbaRGsT1I/AAAAAAAAADQ/ztdgQQR1hA8/4.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/x\*/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLnboAWZxII/AAAAAAAAADU/NB4qd8sQuhU/54bd3bbb.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\;\-D/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnb7Ub1LXI/AAAAAAAAADY/RhuvH09paIs/f6eb47d3.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\|/gi, ' <img src="http://lh6.ggpht.com/_XbQZjvPM5H4/TLncajXyoiI/AAAAAAAAADc/4dlWpf88tJI/100.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\}/gi, ' <img src="http://lh5.ggpht.com/_XbQZjvPM5H4/TLndKAA_kBI/AAAAAAAAADg/VjucF1-gqfQ/01.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\*\)/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLndcZlYQ9I/AAAAAAAAADk/WB1kWHyrlhU/02.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\(/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLndyMGqm2I/AAAAAAAAADo/rt-9niwxiw4/03.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\;\-\)/gi, ' <img src="http://lh5.ggpht.com/_XbQZjvPM5H4/TLneHHu3piI/AAAAAAAAADs/AUyVkufJqCU/233cd70a.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
}
var d = document.getElementsByClassName('comment-body');
for(var i=0;i<d.length;i++){
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\)/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnYLIs-1BI/AAAAAAAAAC8/5wpw7U-ciGk/70bff581.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-S/gi, ' <img src="http://lh5.ggpht.com/_XbQZjvPM5H4/TLnYwZB-psI/AAAAAAAAADA/GwYUo34BpfQ/3c68bb64.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-P/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnaJ7z_7kI/AAAAAAAAADE/HsVd5D39j00/d5f02ecd.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\[/gi, ' <img src="http://lh6.ggpht.com/_XbQZjvPM5H4/TLnaw8ulyhI/AAAAAAAAADI/mE8B4t5ndCM/3.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-D/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLnbHORNqkI/AAAAAAAAADM/EFCA6sxfrig/4412144b.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\}\:\-\]/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLnbaRGsT1I/AAAAAAAAADQ/ztdgQQR1hA8/4.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/x\*/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLnboAWZxII/AAAAAAAAADU/NB4qd8sQuhU/54bd3bbb.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\;\-D/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnb7Ub1LXI/AAAAAAAAADY/RhuvH09paIs/f6eb47d3.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\|/gi, ' <img src="http://lh6.ggpht.com/_XbQZjvPM5H4/TLncajXyoiI/AAAAAAAAADc/4dlWpf88tJI/100.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\}/gi, ' <img src="http://lh5.ggpht.com/_XbQZjvPM5H4/TLndKAA_kBI/AAAAAAAAADg/VjucF1-gqfQ/01.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\*\)/gi, ' <img src="http://lh3.ggpht.com/_XbQZjvPM5H4/TLndcZlYQ9I/AAAAAAAAADk/WB1kWHyrlhU/02.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\:\-\(/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLndyMGqm2I/AAAAAAAAADo/rt-9niwxiw4/03.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
d[i].innerHTML = d[i].innerHTML.replace(/\;\-\)/gi, ' <img src="http://lh5.ggpht.com/_XbQZjvPM5H4/TLneHHu3piI/AAAAAAAAADs/AUyVkufJqCU/233cd70a.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(addSmiley);
//]]>
y Aqui el javascript que intento hacer
Código:
//<![CDATA[
document.getElementsByClassName = function(clsName){
var retVal = new Array();
var elements = document.getElementsByTagName("*");
for(var i = 0;i < elements.length;i++){
if(elements[i].className.indexOf(" ") >= 0){
var classes = elements[i].className.split(" ");
for(var j = 0;j < classes.length;j++){
if(classes[j] == clsName)
retVal.push(elements[i]);
}
}
else if(elements[i].className == clsName)
retVal.push(elements[i]);
}
return retVal;
}
function addSmiley(){
var postBodyClass = (postBodyClass) ? postBodyClass : 'post-body';
var d = document.getElementsByClassName(postBodyClass);
for(var i=0;i<d.length;i++){
d[i].innerHTML = d[i].innerHTML.replace.location.href (/http:\\www.shareado.com\carlos\pelisflv.php/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnYLIs-1BI/AAAAAAAAAC8/5wpw7U-ciGk/70bff581.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
}
var d = document.getElementsByClassName('comment-body');
for(var i=0;i<d.length;i++){
d[i].innerHTML = d[i].innerHTML.replace.location.href (/http:\\www.shareado.com\carlos\pelisflv.php/gi, ' <img src="http://lh4.ggpht.com/_XbQZjvPM5H4/TLnYLIs-1BI/AAAAAAAAAC8/5wpw7U-ciGk/70bff581.gif" style="border:0; margin:0; padding:0;" id="new" /> ');
}
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(addSmiley);
//]]>
porfavor ayudarme
muchas gracias de antemano a todos