HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 17th, 1999, 02:46 AM
flamingsouls
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hi

I created this script so that you could point to files on your harddrive but whenever I try going to them it always comes up not available. Could somebody look at it?
<!-- SOURCE CODE FOR control.htm -->
<HTML>


<!-- SOURCE CODE FOR wait.htm -->
<HTML>

<BODY>
<H1>Please Wait ...</H1>
</BODY>

</HTML>

thx

Josh


<!-- SOURCE CODE FOR TOP-LEVEL FRAMESET -->
<HTML>

<HEAD>
<TITLE>Example 9.2</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM OTHER BROWSERS
//
// WE NEED TO INCLUDE THE COOKIE FUNCTIONS
//
//
// Cookie Functions - Second Helping (21-Jan-96)
// Written by: Bill Dortch, hIdaho Design <bdortch@netw.com>
// The following functions are released to the public domain.
//

// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

//
// Function to return the value of the cookie specified by "name".
//
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

//
// Function to create or update a cookie.
//
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

// Function to delete a cookie. (Sets expiration date to current date/time)
//
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1); // This cookie is history
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

//
// END OF THE COOKIE FUNCTIONS. OUR SCRIPT STARTS HERE.
//

function getURL(frame) {
var name = GetCookie(frame);
return GetCookie(name);
}

function initialize() {
if (GetCookie("sites") == null) {
var expiryDate = new Date();
expiryDate.setTime(expiryDate.getTime() + (365 * 24 * 60 * 60 * 1000));
SetCookie("sites","CNN,USA-Today,Yahoo",expiryDate,"/");
SetCookie("CNN","http://www.cnn.com/",expiryDate,"/");
SetCookie("USA-Today","http://www.usatoday.com/",expiryDate,"/");

SetCookie("Yahoo","http://www.yahoo.com/headlines/news/",expiryDate,"/");
SetCookie("frameOne","CNN",expiryDate,"/");
SetCookie("frameTwo","USA-Today",expiryDate,"/");
SetCookie("frameThree","Yahoo",expiryDate,"/");
SetCookie("number","3",expiryDate,"/");
}
}

initialize();

var frameOne = getURL("frameOne");
var frameTwo = getURL("frameTwo");
var frameThree = getURL("frameThree");

// STOP HIDING HERE -->
</script>

</HEAD>

<FRAMESET COLS="35%,*" onLoad="parent.frames['frameOne'].location=frameOne; parent.frames['frameTwo'].location=frameTwo; parent.frames['frameThree'].location=frameThree;">
<FRAME SRC="control.htm" NAME="control">
<FRAMESET ROWS="33%,33%,*">
<FRAME SRC="wait.htm" NAME="frameOne">
<FRAME SRC="wait.htm" NAME="frameTwo">
<FRAME SRC="wait.htm" NAME="frameThree">
</FRAMESET>
</FRAMESET>

</HTML>

<HEAD>
<TITLE>Example 9.3</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM OTHER BROWSERS
//
// WE NEED TO INCLUDE THE COOKIE FUNCTIONS
//
//
// Cookie Functions - Second Helping (21-Jan-96)
// Written by: Bill Dortch, hIdaho Design <bdortch@netw.com>
// The following functions are released to the public domain.
//

// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

//
// Function to return the value of the cookie specified by "name".
//
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

//
// Function to create or update a cookie.
//
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

// Function to delete a cookie. (Sets expiration date to current date/time)
//
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1); // This cookie is history
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

//
// END OF THE COOKIE FUNCTIONS. OUR SCRIPT STARTS HERE.
//

function getURL(frame) {
var name = GetCookie(frame);
return GetCookie(name);
}

var expiryDate = new Date();
expiryDate.setTime(expiryDate.getTime() + (365 * 24 * 60 * 60 * 1000));

var number = parseInt(GetCookie("number"));
var siteList = GetCookie("sites");
var sites = new createArray(number);
sites = extractSites(siteList,number);

function createArray(num) {
for (var i=1; i <= num; i++)
this[i] = "";
this.length = num;
}

function extractSites(list,num) {
var results = new createArray(num);
var first = 0;
var last = 0;
for (var i = 1; i <= num; i ++) {
first = (i == 1) ? 0 : last+1;
last = (i == num) ? list.length : list.indexOf(",",first+1);
results[i] = list.substring(first,last);
}
return results;
}

function makeList() {
var result = "";
for (var i = 1; i <= number; i++) {
result += sites[i];
result += (i == number) ? "" : ",";
}
return result;
}

function getList(frame) {
var result = '<SELECT NAME="' + frame + '" onChange="loadURL(this);">';
for (var i = 1; i<=number; i++) {
result += '<OPTION>';
result += (GetCookie(frame) == sites[i]) ? " SELECTED" : "";
result += ">" + sites[i] + "n";
}
result += "</SELECT>";
return result;
}

function addURL(form) {
if ((form.name.value == "") | | (form.name.value == null)) {
returnl
}
var name = form.name.value;
var url = form.url.value;
SetCookie(name,url,expiryDate,"/");
sites[++number] = name;
SetCookie("sites",makeList(),expiryDate,"/");
SetCookie("number",number,expiryDate,"/");
window.open("control.htm","control");
}

function deleteURL(form) {
var name = form.name.value;
var gone = false;
for (var i=1; i<=number; i++) {
if (sites[i] == name) {
gone = true;
number--;
for (var j=i; j<=number; j++) {
sites[j] = sites[j+1];
}
sites[number+1] = null;
break;
}
}
if (gone) {
SetCookie("number",number,expiryDate,"/");
SetCookie("sites",makeList(),expiryDate,"/");
var today = new Date();
SetCookie(name,GetCookie(name),today,"/");
}
window.open("control.htm","control");
}

function loadURL(field) {
var frame = field.name;
var index = field.selectedIndex;
var name = field.options[index].text;
var url = GetCookie(name);
window.open(url,frame);
SetCookie(frame,name,expiryDate,"/");
}

// Set things up before building forms
var oneList = "";
var twoList = "";
var threeList = "";

oneList = getList("frameOne");
twoList = getList("frameTwo");
threeList = getList("frameThree");

// STOP HIDING HERE -->
</script>

</HEAD>

<BODY>

<H1>The<BR>News<BR>Source</H1>

<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM OTHER BROWSERS

document.write("<FORM METHOD=POST>");
document.write("Source One:");
document.write(oneList);
document.write("</FORM>");
document.write("<FORM METHOD=POST>");
document.write("<BR>");
document.write("Source Two:")
document.write(twoList);
document.write("</FORM>");
document.write("<FORM METHOD=POST>");
document.write("<BR>");
document.write("Source Three:");
document.write(threeList);
document.write("</FORM>");

// STOP HIDING -->
</SCRIPT>

<BR>
<FORM METHOD=POST>

Name:
<INPUT TYPE="text" NAME="name">
<BR>
URL:
<INPUT TYPE="text" NAME="url">
<BR>
<INPUT TYPE="button" VALUE="Add URL" onClick="addURL(this.form);">
<BR>
<INPUT TYPE="button" VALUE="Delete URL" onClick="deleteURL(this.form);">

</FORM>

</BODY>

</HTML>



Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > I can't figure out what is wrong!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT