No it's not that bad.
If you will apply proper techniques and good workaround in your script, im sure everything can be organized.

Here's a short example, so that you can see the big difference between the codes.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script type="text/javascript">
// <![CDATA[
var include, url;

include = function( url ) {
   loc = "#http://www.web#site.#com/#contact".replace(/^#*/i, "");

  alert( loc ); // Check the first pattern and observed the output w/o g-flag.

  delete loc;

  loc = "#http://www.web#site.#com/".replace(/#/ig, ""); // With g-flag's!

  alert( loc + url ) // Now we will use it with a global flag and by adding up some arguments' we can organized everything and also remove unnecessary characters in the url. 

window.onload = include( "#contact" );

// ]]>


I suppose it depends on what your circumstances are. I assumed that he was using AJAX and had a link like what he proposed. If he just needed to remove the first #, he could also have done:

var string = "#";
var newString = string.substr(1);
This article has been dead for over six months. Start a new discussion instead.