don't execute script if url contains #
<p>i would like to execute the script below only if the url doesn't contains #</p>

<p>So don't execute script if url = <a href="http://win-e98sopqc735/Previsions/Lists/Prvisions/ViewParDateJour.aspx#ServerFilter=FilterField1" rel="nofollow">http://win-e98sopqc735/Previsions/Lists/Prvisions/ViewParDateJour.aspx#ServerFilter=FilterField1</a></p>

<p>but execute if url =
<a href="http://win-e98sopqc735/Previsions/Lists/Prvisions/ViewParDateJour.aspx" rel="nofollow">http://win-e98sopqc735/Previsions/Lists/Prvisions/ViewParDateJour.aspx</a></p>

<pre><code>function addDays(dateObj, numDays) {
            dateObj.setDate(dateObj.getDate() + numDays);
            return dateObj;
        }

        function dateToShortString(date) {
            var d = date.getDate();
            var days = (d &lt; 10) ? '0' + d : d;
            var m = date.getMonth() + 1;
            var month = (m &lt; 10) ? '0' + m : m;
            var year = date.getFullYear();
            var shortDateString = days + "/" + month + "/" + year;
            return shortDateString;
        }

        var now = new Date();
        var today = dateToShortString(now);
        var tomorrow = dateToShortString(addDays(now, 1));
        var nextWeek = dateToShortString(addDays(now, 8));


        var url = location.pathname;
        //Set today's date if url contains ViewParRubriqueJour.aspx and ViewParDateJour.aspx
        if (url.indexOf('ViewParRubriqueJour.aspx') &gt;= 0 || url.indexOf('ViewParDateJour.aspx') &gt;= 0) {
            jQuery("input[id*='ctl00_ctl00_ctl00']").val(today);
            jQuery("input[id*='ctl00_ctl01_ctl00']").val(today);
        }
        //Set tomorrow's date if url contains ViewParDateDemain.aspx and ViewParRubriqueDemain.aspx
        if (url.indexOf('ViewParDateDemain.aspx') &gt;= 0 || url.indexOf('ViewParRubriqueDemain.aspx') &gt;= 0) {
            jQuery("input[id*='ctl00_ctl00_ctl00']").val(tomorrow);
            jQuery("input[id*='ctl00_ctl01_ctl00']").val(tomorrow);
        }
        //Set 7 days date if url contains ViewParDate7.aspx and ViewParRubrique7.aspx
        if (url.indexOf('ViewParDate7.aspx') &gt;= 0 || url.indexOf('ViewParRubrique7.aspx') &gt;= 0) {
            jQuery("input[id*='ctl00_ctl00_ctl00']").val(tomorrow);
            jQuery("input[id*='ctl00_ctl01_ctl00']").val(nextWeek);
        }
</code></pre>
