Chapter Fourteen |
Or, "Where Am I and How Did I Get Here?" or, "Where Do I Go Now?" variable=location.href;
str=location.href; will set str as follows: str="http://www.autoscripter.com/index.htm"; or str="ftp://autoscripter.com/index.htm"; But if you are viewing a file on your own system, it will take the general form of: str="file:///Harddrive/JavaScript/index.htm"; Note that the local path begins with file: and is followed by three slashes, while the internet paths are followed by just two slashes.
Built-in Calls that Parse the .href
location.protocol
Using these location calls, this location.href is parsed into its various components automatically as shown just below: http://www.autoscripter.com:80/js/a.htm#top?x=1 returns:
This little script incorporates the various location calls so that you can see them in action: <HTML><HEAD>
|
Links: Introduction | Chapter One | Chapter Two | Chapter Three | Chapter Four | Chapter Five | Chapter Six | Chapter Seven | Chapter Eight | Chapter Nine | Chapter Ten | Chapter Eleven | Chapter Twelve | Chapter Thirteen | Chapter Fifteen | Chapter Sixteen | Chapter Seventeen | Chapter Eighteen | Chapter Nineteen | Chapter Twenty | Chapter Twenty-one | Chapter Twenty-two | Chapter Twenty-three | Appendix A | Appendix B | Appendix C | Appendix D | Cover This free virtual book provided courtesy of: AutoScripter(tm), the site for professional Web Designers and Developers and WebWalker Virtual Press, virtual publishing on the Web since 1994 Other free e-books from WebWalker: The All American Terrorists | The Gnomes of Jost | For the Love of Entropy | The Trees of Kratva | The Arch of Rain Magicians | Lightshow | The Black Mancutters Guild | The Septoracle © Copyright 1997, 1999, 2000, 2001 John H. Keyes editor@jorika.com |