thecard Posted July 16, 2008 Share Posted July 16, 2008 //Parses Name of Domain function parseUri (str) { var o = parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { if ($1) uri[o.q.name][$1] = $2; }); return uri; }; parseUri.options = { strictMode: false, key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?[^:\/?#]+)?(?:\/\/((?([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?:\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(??![^:@]+:[^:@\/]*@)([^:\/?#.]+)?(?:\/\/)?((?([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?:\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ } }; parseUri.(window.location); document.write(host); I have found this function (parseUri.) on the internet. (It parses Urls). Whats wrong with what I do next: parseUri.(window.location); document.write(host); Thanks. Quote Link to comment Share on other sites More sharing options...
Xurion Posted July 16, 2008 Share Posted July 16, 2008 All you're doing at the end of the script is trying to write the host variable to the screen. From what I can see, the host variable isn't set, so it appears nothing is written. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.