I have a series of variables which ultimately form a hyperlink. During the document write process for the actual hyperlink if there are spaces found the string breaks and does not include any characters past the space. I am using a replace function on the input variable to accomodate for this and add "%20", however just found the way I wrote it, this is only replacing the first instance... Any thoughts out there on how to do this the right way to catch all spaces in the string?
<script language="javascript" type="text/javascript">
var path = "http://URL/";
var report = reportSelect.value;
var reportName = report.replace(/ /,"%20");
document.write(report + "<BR/>" + "<A href=" + path + reportName + ".xml" + " target=viewer>" + "Show Report" + "</A>")
</script>



Reply With Quote



Bookmarks