antun
04-18-2003, 08:32 AM
LzURL is a handy class for parsing and editing URLs. Say you have a URL as follows:
http://www.laszlosystems.com/img/h_head_logo.gif
And you want to get an image called smiley.gif, that you know is in the same folder. You could go the long route and parse the URL manually, but it's much quicker to create an instance of the LzURL class and edit just the file component of it:
<canvas debug="true">
<script>
var urlStr = 'http://www.laszlosystems.com/img/logo.gif';
var url = new LzURL( urlStr );
url.file = 'smiley.gif';
debug.write( url.toString() );
</script>
</canvas>
In the same way, you could alter the following components of the URL:
protocol
host
port
path
file
query
Enjoy!
http://www.laszlosystems.com/img/h_head_logo.gif
And you want to get an image called smiley.gif, that you know is in the same folder. You could go the long route and parse the URL manually, but it's much quicker to create an instance of the LzURL class and edit just the file component of it:
<canvas debug="true">
<script>
var urlStr = 'http://www.laszlosystems.com/img/logo.gif';
var url = new LzURL( urlStr );
url.file = 'smiley.gif';
debug.write( url.toString() );
</script>
</canvas>
In the same way, you could alter the following components of the URL:
protocol
host
port
path
file
query
Enjoy!