<html>

 

<head>

 

<title>Day 1 Homework Controls</title>

 

 

 

<script language="JavaScript">

 

<!-- hide me

 

 

 

function favJump()

 

{

 

        var the_select = window.document.fav_form.favorites;

 

        var the_text = the_select.options[the_select.selectedIndex].text;

 

        if (isURL(the_text))

 

        {

 

                window.document.loc_form.the_url.value = the_text;

 

                goThere(the_text);

 

        }

 

}

 

 

 

function isURL(some_text)

 

{

 

        var the_first_seven = some_text.substring(0,7);

 

        the_first_seven = the_first_seven.toLowerCase();

 

        if (the_first_seven != 'http://')

 

        {

 

                return false;

 

        } else {

 

                return true;

 

        }

 

}

 

 

 

function goThere(the_url)

 

{

 

        if (the_url != "") {   

 

                var good_url = fixURL(the_url);

 

                var new_window = parent.browser_page.location.replace(good_url);

 

        } else {

 

                return false;       

 

        }

 

}

 

 

 

function fixURL(the_url)

 

{

 

        if (isURL(the_url) == false)

 

        {

 

                the_url = "http://" + the_url;

 

        }

 

        return the_url;

 

}

 

 

 

 

 

 

 

function addToFavorite()

 

{

 

 

 

        var the_url = prompt("Add which URL to your favorites? ","http://");

 

        if ((the_url != "") && (the_url != null) && (the_url != false))

 

        {

 

                var good_url = fixURL(the_url);

 

                var the_favorites = window.document.fav_form.favorites;

 

                var num_options = the_favorites.options.length;

 

                var new_option = new Option;

 

                new_option.text = good_url;

 

                the_favorites.options[num_options]= new_option;         

 

        }      

 

}

 

 

 

 

 

// end hide -->

 

</script>

 

</head>

 

 

 

<body>

 

<table width="90%">

 

<tr>

 

<td>

 

<form name="fav_form">

 

 

 

<img src="http://a1112.g.akamai.net/7/1112/492/02012000/static.wired.com/webmonkey/98/04/images3a/back.gif">

 

<img src="http://a1112.g.akamai.net/7/1112/492/02012000/static.wired.com/webmonkey/98/04/images3a/forth.gif">

 

<a href="homework_default.html" target="browser_page"><img src="http://a1112.g.akamai.net/7/1112/492/02012000/static.wired.com/webmonkey/98/04/images3a/home.gif" border="0"></a>

 

<a href="#" onClick="addToFavorite(); return false;"><img src="http://a1112.g.akamai.net/7/1112/492/02012000/static.wired.com/webmonkey/98/04/images3a/add.gif" border="0"></a>

 

 

 

<b>Favorites: </b>

 

<select name="favorites" size="1" onChange="favJump();">

 

<option>Pull down to jump to your favorite site

 

<option>http://www.hits.org

 

<option>http://www.hits.org/osprey

 

</select>

 

</form>

 

</td>

 

 

 

<td><a href="brand_me.html" target="browser_page"><img src="http://a1112.g.akamai.net/7/1112/492/02012000/static.wired.com/webmonkey/98/04/images3a/monkey.gif" name="brand_image" border="0"></a></td>

 

</tr>

 

 

 

<tr>

 

<td>

 

<form name="loc_form" onSubmit="goThere(window.document.loc_form.the_url.value); return false;">

 

<b>Location:</b><input type="text" name="the_url" size=40>

 

</form>

 

</td>

 

<td></td>

 

</tr>

 

</table>

 

</body>

 

</html>