Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

permission denied?????

Status
Not open for further replies.

mackey333

Technical User
May 10, 2001
563
0
0
US
what exactly does a permissission denied jscript error mean?...I am getting it on this line:

clockProb = window.prompt("What is wrong with this clock?","It's broken");
-Greg :-Q

flaga.gif
 
ok, here is the faulty if statment:

if (confirm("Create a clock for " + inName + "?")) {

//clockProb = window.prompt("What is wrong with this clock?", "It's broken");
//clockIdea = window.prompt("Enter some ideas to fix the problem", "Beat it with a hammer");
//document.cookie=inName + "clockProb=" + clockProb + ";expires=" + expireDate.toGMTString();
//document.cookie=inName + "clockIdea=" + clockIdea + ";expires=" + expireDate.toGMTString();
//document.cookie=inName + "clockName=" + inName + ";expires=" + expireDate.toGMTString();
//document.cookie=inName + "=clock2;expires=" + expireDate.toGMTString();

//alert("the clock for " + inName + " has been created");
//window.location = "javascript:history.go(0)";
}

if i go down and comment the lines, there is a permission denied error on all of them, except the if (confirm)...and the closing brace...there is even permission denied on the window.location...what does this error mean? -Greg :-Q

flaga.gif
 
Greg

I can't see any reason for this error given the script you've posted. (Just pasted it into an empty HTML page and worked fine)

Are you using frames or opening new windows?
Bill Bruggemeyer
 
here is the whole page:
Code:
<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<title>Clock Manager Utilities</title>
<script language=&quot;javscript&quot; src=&quot;../css_classes/clock.js&quot;></script>
<link rel=&quot;stylesheet&quot; href=&quot;../css_classes/scrollBar.css&quot; type=&quot;text/css&quot;>
<link rel=&quot;stylesheet&quot; href=&quot;../css_classes/display_controls.css&quot; type=&quot;text/css&quot;>

<script language=&quot;javascript&quot;>

var key, clockName, clockProb, clockIdea, length, inUse, element, status, place

expireDate = new Date
deleteDate = new Date
expireDate.setMonth(expireDate.getMonth()+240)
deleteDate.setMonth(expireDate.getMonth()-1)
thisCookie = document.cookie.split(&quot;; &quot;)

key = new Array(); 
key['13'] = &quot;javascript:clockAction()&quot;;
key['113'] = &quot;../../clock_manager.htm&quot;;
key['118'] = &quot;javascript:scroll('up')&quot;;
key['119'] = &quot;javascript:scroll('down')&quot;;

function getKey(keyStroke) {
	
	for (var i in key) if (event.keyCode == i) window.location = key[i];

}
document.onkeydown = getKey;


function scroll(dir) {

	if (dir == &quot;up&quot;) {
		document.options.clock.selectedIndex--
		
	} else {
		document.options.clock.selectedIndex++
	}
}


function loadClocks() {

	for (i=0; i<thisCookie.length; i++) {
	
		if (thisCookie[i].split(&quot;=&quot;)[1] == &quot;clock2&quot;) {
			
			document.write(&quot;<option value=&quot; + thisCookie[i].split(&quot;=&quot;)[0] + &quot;>&quot; + thisCookie[i].split(&quot;=&quot;)[0] + &quot;</option>&quot;);
		}
	}
}

function clockAction() {

	if (status == &quot;in&quot; && place == &quot;new&quot;) {	
		var h = 0
		var j = 0
		var k = 0
		var g = 0
		var c = 0
		var check
		var inName = document.options.newClock.value.toLowerCase().replace(&quot; &quot;, &quot;_&quot;)
		var testStr = inName.substring(1, + inName.length)
			
		clockName = document.options.newClock.value.toLowerCase()

		if (clockName != &quot;&quot;) {
			for (i=0; i<thisCookie.length; i++) {  //check if name is in use
				if (clockName == thisCookie[i].split(&quot;=&quot;)[0].substring(0, + thisCookie[i].split(&quot;=&quot;)[0].length -9) && h == 0) {
				
					inUse = true;
					alert(&quot;that name is in use, delete the old name, or change the new name (try adding a first name or a number on the front)&quot;);
					document.options.newClock.value = &quot;&quot;;
					h++
					k++
				}
			} 			
			
			if(!inUse) {
				for (c=0; c<10; c++) { //check for a number at the last character
					if (g == 0) {
						if(testStr.search(c) != -1) {
							g++;
							inUse = true;
							alert(&quot;you cannot have a number at the end of the name, you must put it at the front&quot;);
							window.location = &quot;javascript:history.go(0)&quot;;
					
						}
					}
				} 
			}
			
			if (!inUse) {
			
				if (window.confirm(&quot;Create a clock for &quot; + inName + &quot;?&quot;)) {
		
					clockProb = window.prompt(&quot;What is wrong with this clock?&quot;, &quot;It's broken&quot;);
					clockIdea = window.prompt(&quot;Enter some ideas to fix the problem&quot;, &quot;Beat it with a hammer&quot;);	
         			document.cookie=inName + &quot;clockProb=&quot; + clockProb + &quot;;expires=&quot; + expireDate.toGMTString();
					document.cookie=inName + &quot;clockIdea=&quot; + clockIdea + &quot;;expires=&quot; + expireDate.toGMTString();
					document.cookie=inName + &quot;clockName=&quot; + inName + &quot;;expires=&quot; + expireDate.toGMTString();
					document.cookie=inName + &quot;=clock2;expires=&quot; + expireDate.toGMTString();
					
					alert(&quot;the clock for &quot; + inName + &quot; has been created&quot;);
					window.location = &quot;javascript:history.go(0)&quot;;
				}
			} else {
				alert(&quot;That name is in use already&quot;);
				window.location=&quot;javascript:history.go(0)&quot;;
			}
		} else {
			alert(&quot;You didn't enter a name&quot;);
		}
		
	}  else if (status ==&quot;in&quot; && place == &quot;del&quot;) {
	
		clockName = document.options.clock.options[document.options.clock.selectedIndex].value
		length = clockName.length
 	
		if (clockName != &quot;pick&quot; && clockName != &quot;end&quot;) {
	
 			if (confirm(&quot;delete &quot; + clockName + &quot;'s clock?&quot;)) {
 	
 				for (i=0; i<thisCookie.length; i++) {
 	
 					if (thisCookie[i].split(&quot;=&quot;)[0].substr(0, + length) == clockName) {
 			
 						document.cookie=thisCookie[i].split(&quot;=&quot;)[0] + &quot;=null;expires=&quot; + deleteDate.toGMTString();
	 				}
 				}
 			alert(clockName + &quot;'s clock has been deleted&quot;);			
	 		window.location=&quot;javascript:history.go(0)&quot;;
 			}
 		} else {
 			alert(&quot;pick a clock first&quot;);
 		}
 	}
}

function checkFocus(element, status2) {

	if (status2 == &quot;in&quot;) {
		place = element
		status = &quot;in&quot;
	
	} else {
		place = &quot;null&quot;
	}
}
// end -->
</script>
</head>

<body onLoad=&quot;document.options.newClock.focus()&quot;>

<br>

<p align=&quot;center&quot;>
	
	<b>
	<font face=&quot;Comic Sans MS&quot; size=&quot;4&quot;>
        
		<span style=&quot;letter-spacing: 2pt&quot;>
			Clock Manager Utilities
		</span>
		
	</font>
	</b>
	<hr>

<br>


	<p align=&quot;center&quot;>
		
			<form name=&quot;options&quot; method=&quot;post&quot; action=&quot;javascript:history.go(0)&quot;>
   		
        <p align=&quot;center&quot;>
   		
   		create a new clock: 
   		
   		<input type=&quot;text&quot; name=&quot;newClock&quot; size=&quot;20&quot; onFocus=&quot;checkFocus('new', 'in')&quot; onBlur=&quot;checkFocus('new', 'out')&quot;> 
   			press 'enter' to create
        <p>
	
	<br>

	<p align=&quot;center&quot;>

		delete a clock: 
		
		<select size=&quot;1&quot; name=&quot;clock&quot; onFocus=&quot;checkFocus('del', 'in')&quot; onBlur=&quot;checkFocus('del', 'out')&quot;>
			<option selected value=&quot;pick&quot;>
                --pick a clock--
			</option>
		
			<script language=&quot;javascript&quot;>
				loadClocks();
			</script>
		
			<option value=&quot;end&quot;>
			--end, scroll up--
			</option>
		</select>

   			press 'enter' to delete
   		
   		</form>
   		
<hr>
<p align=&quot;center&quot;>
	
	Use 'F7' and 'F8' to scroll the selection box
	<br>
	Press 'F2' to return to the main menu
	
</p>
	
	<p align=&quot;center&quot;>

		<span id=&quot;clock&quot; style=&quot;position:relative&quot;>

	</p>
</body>

</html>


***************clock.js****************

function displayTime() {

	var today;
	var time;

	today = new Date();
	time = today.toLocaleString()
	clock.innerHTML = time;
	setTimeout(&quot;displayTime()&quot;, 500)
		
}

************display_controls.css*************
body {
	color: #FFFFFF;
	background-image: url(../../images/zertxtr.gif);
	background-attachment: fixed;
	font: comic sans ms;
	font-weight: bold;
	size: 12pt;
}

a:hover {
	color: darkred;
	font: comic sans ms
	font-weight: bold;
	size: 14pt;
}
a {
	color: #0066CC;
	font-weight: bold;
	font: comic sans ms
	size: 12pt;
}

************scrollBar.css**********

body {
	scrollbar-face-color: #000000; 
	scrollbar-shadow-color: #FFFFFF; 
	scrollbar-highlight-color: #FFFFFF; 
	scrollbar-3dlight-color: #000000; 
	scrollbar-darkshadow-color:#000000; 
	scrollbar-track-color: #000000; 
	scrollbar-arrow-color: #FFFFFF;
}

**************************************
even if you can't find the error...can anyone tell me what this error means...vituz, tsdragon???? -Greg :-Q

flaga.gif
 
ok...the plot thickens...if i take out the 2 prompts and the cookies, i get an object expected on the alert that says the clock has been created...even with out the variable (like it was trying to call a function called alert() and pass the string in)...if i write it as window.alert, then i get a permission denied error...it's almost like it just decided to stop using anything dealing with the document and window objects in that if statement -Greg :-Q

flaga.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top