PDA

View Full Version : How do I change object path


Alfonso
08-28-2002, 12:07 AM
I am a beginner programmer in JavaScript. I use FrontPage.

In my program I want to open a certain document in a new window.

The window opens up but the document isn't there.

The only way I can get it to show is by sticking it in the Tempory folder of FrontPage.

I was wondering if anyone knows how to change the path of the document to show up without sticking it in the Temp folder.

Please help!!!!!!!!!!!

sicknesslife
08-28-2002, 03:34 AM
if you post the code you are using we might be able to help:thumbsup:

Alfonso
08-28-2002, 05:50 AM
<html>

<head>

<script language = javascript>

//This adjusts the backround colour of the page
document.bgColor="9999ff"

//This adjusts the font colour on the page
document.fgColor="ffff00"

//This is the main heading of the page
document.write("<center><h3>Welcome to The IPT Student's Guide to Algorithmic programming using JavaScript</h3></center>")

//This is the beginning of the functions within the table

//This is the code to view the code for data types and operations
function Window1()
{
window.open("results.txt" , "Win1")
}

//This is the function to run the data types and operations program
function Window1a()
{
window.open("Results.htm" , "Win1a")
}

//This is the code to view the code for input/output
function Window2()
{
window.open("results.txt" , "Win2")
}

//This is the function to run the input/output program
function Window2a()
{
window.open("Results.htm" , "Win2a")
}

//This is the code to view the code for selection
function Window3()
{
window.open("select.txt" , "Win3")
}

//This is the function to run the selection program
function Window3a()
{
window.open("Select.htm" , "Win3a")
}

//This is the code to view the code for iteration
function Window4()
{
window.open("for.txt" , "Win4")
}

//This is the function to run the iteration program
function Window4a()
{
window.open("For.htm" , "Win4a")
}

//This is the code to view the code for error types, error trapping and common error
function Window5()
{
window.open("results.txt" , "Win5")
}

//This is the function to run the error types, error trapping and common error program
function Window5a()
{
window.open("Results.htm" , "Win5a")
}

//This is the code to view the code for object and event handling
function Window6()
{
window.open("event.txt" , "Win6")
}

//This is the code to view the code for object and event handling
function Window61()
{
window.open("event2.txt" , "Win61")
}

//This is the function to run the object and event handling program
function Window6a()
{
window.open("Event.htm" , "Win6a")
}

//This is the function to run the object and event handling program
function Window6b()
{
window.open("Event2.htm" , "Win6b")
}

//This is the code to view the code for random number
function Window7()
{
window.open("randnum.txt" , "Win7")
}

//This is the function to run the random number program
function Window7a()
{
window.open("RandNum.htm" , "Win7a")
}

</script>

</head>

<body>

<!-- "This is the beginning of the main operations table." -->
<div align="center">
<center>
<table border="2" width="101%" height="338">
<tr>
<td width="26%" align="center" height="38">Aspect of Algorithmic Programming</td>
<td width="21%" align="center" height="38">The Code</td>
<td width="34%" align="center" height="38">The Example Described</td>
<td width="20%" align="center" height="38">Run The Example</td>
</tr>
<tr>
<td width="26%" height="38">Data types and operations in JavaScript</td>
<td width="21%" height="38"><input type = "button" value = "Show the code" OnClick = "Window1()"></td>
<td width="34%" height="38">This program demonstrates basic operations and data types in JavaScript.</td>
<td width="20%" height="38"><input type = "button" value = "Run the code" OnClick = "Window1a()"></td>
</tr>
<tr>
<td width="26%" height="57">Input and output statements</td>
<td width="21%" height="57"><input type = "button" value = "Show the code" OnClick = "Window2()"></td>
<td width="34%" height="57">This program accepts data input and provides output
based on the input data.</td>
<td width="20%" height="57"><input type = "button" value = "Run the code" OnClick = "Window2a()"></td>
</tr>
<tr>
<td width="26%" height="25">Selection constructs</td>
<td width="21%" height="25"><input type = "button" value = "Show the code" OnClick = "Window3()"></td>
<td width="34%" height="25">This program lets the user select certain data and produce and output based
upon the data selected.</td>
<td width="20%" height="25"><input type = "button" value = "Run the code" OnClick = "Window3a()"></td>
</tr>
<tr>
<td width="26%" height="31">Iteration constructs</td>
<td width="21%" height="31"><input type = "button" value = "Show the code" OnClick = "Window4()"></td>
<td width="34%" height="31">This program preforms a certain operation for a set number of turns.</td>
<td width="20%" height="31"><input type = "button" value = "Run the code" OnClick = "Window4a()"></td>
</tr>
<tr>
<td width="26%" height="38">Error types, Error trapping and Common Errors</td>
<td width="21%" height="38"><input type = "button" value = "Show the code" OnClick = "Window5()"></td>
<td width="34%" height="38">This program demonstrates various error possibilities within JavaScript.</td>
<td width="20%" height="38"><input type = "button" value = "Run the code" OnClick = "Window5a()"></td>
</tr>
<tr>
<td width="26%" height="25">Object and event handlers</td>
<td width="21%" height="25"><input type = "button" value = "Show the code" OnClick = "Window6()">
<input type = "button" value = "Show the code" OnClick = "Window61()"></td>
<td width="34%" height="25">This program demonstrates a basic event handling operation.</td>
<td width="20%" height="25"><input type = "button" value = "Run the code" OnClick = "Window6a()">
<input type = "button" value = "Run the code" OnClick = "Window6b()"></td>
</tr>
<tr>
<td width="26%" height="38">Random Numbers</td>
<td width="21%" height="38"><input type = "button" value = "Show the code" OnClick = "Window7()"></td>
<td width="34%" height="38">This program simply generates a number between 1 and 10 inclusive.</td>
<td width="20%" height="38"><input type = "button" value = "Run the code" OnClick = "Window7a()"></td>
</tr>
</table>
</center>
</div>
<!-- "This is the end of the main operations table." -->

</body>

</html>

mordred
08-28-2002, 09:30 AM
Originally posted by Alfonso
//This is the main heading of the page
document.write("<center><h3>Welcome to The IPT Student's Guide to Algorithmic programming using JavaScript</h3></center>")


LOL. ;)


//This is the code to view the code for data types and operations
function Window1()
{
window.open("results.txt" , "Win1")
}



and so on...
I can't find any syntactical errors in your script - if the desired document does not load, make sure that the paths are set correctly, like

window.open("../results.txt"); // opens results.txt that lies one directory higher

window.open("../stats/results.txt"); // opens results.txt that lies one directory higher, and there in the folder "stats" higher

if all relative paths fail, you can also try it with absolutely referenced URLs or with the single slash that points to the website's root folder.

Alfonso
08-28-2002, 11:57 PM
Thanks guys.

:thumbsup: