PHP gevorderde |
|
Hoi iedereen.
Ik heb een probleem met & en & volgens de XHTML validator moet dit herplaatst worden met & maar dat is onmogelijk want dan werkt mijn JS script totaal niet.
function urlcolour(colour) {
var url = document.location.href;
if( url.indexOf("&colour=") != -1 ) {
var posStart = url.indexOf("&colour=");
var posLength = url.substr(posStart+1).indexOf("&") + 1;
if(posLength == 0) posLength = url.length - posStart;
url = url.substr(0,posStart+8)+colour+url.substr(posStart+posLength);
} else if( url.indexOf("?colour=") != -1 ) {
var posStart = url.indexOf("?colour=");
var posLength = url.substr(posStart+1).indexOf("&") + 1;
if(posLength == 0) posLength = url.length - posStart;
url = url.substr(0,posStart+8)+colour+url.substr(posStart+posLength);
} else {
if( url.indexOf("?") == -1) url += "?colour="+colour;
else url += "&colour="+colour;
}
document.location = url;
}
function urlcolour(colour) { var url = document.location.href; if( url.indexOf("&colour=") != -1 ) { var posStart = url.indexOf("&colour="); var posLength = url .substr(posStart +1).indexOf ("&") + 1; if(posLength == 0) posLength = url.length - posStart; url = url .substr(0,posStart +8)+colour +url .substr(posStart +posLength ); } else if( url.indexOf("?colour=") != -1 ) { var posStart = url.indexOf("?colour="); var posLength = url .substr(posStart +1).indexOf ("&") + 1; if(posLength == 0) posLength = url.length - posStart; url = url .substr(0,posStart +8)+colour +url .substr(posStart +posLength ); } else { if( url.indexOf("?") == -1) url += "?colour="+colour; else url += "&colour="+colour; } document.location = url; }
Weet iemand hier een oplossing voor?
Alvast Bedankt.
|