PDA

View Full Version : Anyone know .HTA?


Code_gate
02-10-2003, 05:03 PM
Does anyone have a good working knowledge of .HTA applications? If so, please let me know as I have a problem that I simply can not solve and I can not find any forums specific to .HTA apps on the Web.

rsci
02-10-2003, 05:08 PM
I have worked with them some. If you post it here I can review it this afternoon otherwise send it to the the email at the bottom and I can comment this evening.

Code_gate
02-10-2003, 05:19 PM
I have the following bit of javascript in my .HTA app:

var loc1=("http://" + theURL);
parent.frames[1].location.href = loc1;

When I save and test this as an HTML file it returns the desired effect: it takes the url entered in the top frame and loads it in the bottom frame.

However, when I save and run the same scripting as an HTA, I receive a script error that says parent.frames.1.location is not an object.

Any help you could offer into this would be greatly appreciated.

rsci
02-10-2003, 07:36 PM
Try using the name of the frame rather than the reference.

myFrame.document.location.href

instead of:

parent.frames[1].location.href

I have used iframes many times (unfortunately I don't have a sample handy here) with no problems. This should be something simple.

joh6nn
02-10-2003, 08:02 PM
1) don't post the same question in more than one place (http://www.codingforums.com/showthread.php?s=&threadid=14419).

2) my guess, this has nothing to do with the .hta. if you post the rest of the code you're using, it will be easier for us to see where your problem is.

Code_gate
02-11-2003, 11:18 AM
1) Sorry about that. I post on several different forums all under the same user name. I usually have them up at the same time on several browser windows and a couple of them look very similar. I will be more careful in the future.

2) Here's the code I am working with. (BTW, I tried switching parent.frames[1].location.href for screen_one.document.location.href but I still received a script error that screen_one was not an object,



The HTA section:

<head>
<HTA:APPLICATION
border="thin"
borderStyle="normal"
caption="yes"
icon="http://www.htmlgoodies.com/favicon.ico"
maximizeButton="yes"
minimizeButton="yes"
showInTaskbar="no"
windowState="maximize"
innerBorder="yes"
navigable="yes"
scroll="auto"
scrollFlat="yes" />

<frameset rows="20%,80%" frameborder="0" border="0">
<frame src="url.html" name="URL" scrolling="no">
<frame src="window.html" name="screen_one" scrolling="auto">
</frameset>
</head>


THE URL FRAME:

<head>
<script type="text/javascript" language="JavaScript">
<!--

function GoToBar(x) {
window.status=('Loading....')
var theURL;
theURL = document.Form1.addr.value
if (theURL == "" || theURL.length <= 5)
{ x.value = "Try Again"
alert('Error!\n\nYou must enter a valid URL');
window.status=('Missing data or Invalid address. Please Try again?.')
}
else
{ x.value = "Going to: http://" + theURL
var loc1=("http://" + theURL);
parent.frames[1].location.href

= loc1;
}
}
//-->
</script>

</head>
<body>
<form name="Form1">
<b>http://</b><input type="text" name="addr" size="25" maxlength="50">
<input type="button" name="GO" value=" Go " onClick="GoToBar(this)">
</form>