Javascript, Iframes, Parent Functions, And Relative Paths

Nov 25, 2009

First the code:

Code:

Looking at the code, you might assume (as I did) that clicking the button on page1.htm would load page2.htm. However for some reason, when calling a parent function, the function runs with the calling file's path rather than the path of the parent.

So it is actually trying to load /files/files/page2.htm! How do I force all calls to parent.function() to run with parent.hta's path as the root?

Realize that this is a simplistic example and simple solutions such as putting all the files in the same path, or dropping the "/files" in the loadPage2() function are not valid solutions.

Essentially I need to call parent.loadPage2() and have it run the function with the root path = parent.hta's path.

View 3 Replies


ADVERTISEMENT

Preloading With Relative Paths

Dec 11, 2005

The two pages for preloading below seemed to preload images IF I used an absolute path but they don't preload the images if I just used relative paths like the ones below.

Give it a try. The two pages below using relative paths won't work. Then try changing the paths of the images in both pages to use absolute path(with http://) which will work.

But I want to use relative paths. What can be done? Other than inserting 1x1 size of the images I want to preload. Code:

View 1 Replies View Related

Relative Paths To External Files

Oct 12, 2011

I have a simple php webpage that links to an external javascript file:

But I want to avoid this:

I've seen so much on the web for Ajaz, ASPX etc. and it all looks a little confusing.

Using ../php/myphp.php works well for php files, what's the way to do it with javascript?

View 9 Replies View Related

Iframes And Parent Window

Nov 7, 2005

If i have an iframe in a page, with dynamically generated db values. Woudl it be possible to write the values of on click to the parent window ?

View 2 Replies View Related

JSs In Iframes Calling Parent Work In FF But No IE...? Help, Please?

Dec 2, 2005

I have a page that is, essentially, a big form. Inside of this form are several iFrames which are intended to populate fields in the form of the parent (follow?). Basically, the form is for the creation of a quick banner ad spec/rough. And in the form, the user needs to position elements. Rather than requiring them to type in pixel values I used an ISMAP that returns the values to it's parent's form's appropriate field. I also do the same with a "choose the background image" - click on the image in an iframe and it is supposed to populate the appropriate field in the parent window's form.

Well, it works fine in Firefox. And, as expected, Explorer sucks and won't do any of the functions within the iframes.

You can't help me without the relevant code so...

View 3 Replies View Related

Positioning A Child Window Relative To The Parent

Jul 23, 2005

I have made a remote control window which opens from its parent. On loading, the remote is positioned relative to the screen using window.moveTo(x,y).

What I would like to happen is the remote control to open docked in a
specific location relative to the parent (opener).

Fortunately, I need this to work ONLY in IE, so at least I don't have to
worry about cross-browser issues.

Does anyone know how to open a window realtive to an anchor in the parent
wiondow?

View 20 Replies View Related

Refresh Parent Page With Iframes On Any Click?

Jan 28, 2009

I have a PHP page with an iframe where I load PERL/CGI content. Now of course when I click anything on the parent page the iframe refreshes with it.

But what I really want is to have the parent page refresh when anything inside the iframe is clicked. Of course the iframe should not refresh and go to initial view then. So basically I am looking for a way to have ONLY the parent page refresh every time something in the frame is clicked or to have the parent page and the iframe refresh but with the iframe retaining the last user position.

View 4 Replies View Related

Javascript & Iframes

Jul 20, 2005

I want to load a javascript file on a root page with various iframes,
then call the javascript functions from the root page to be displayed
in the iframes. Any idea how to do this?

View 2 Replies View Related

JavaScript And IFRAMES

Jun 20, 2006

I have a webpage with some divs and iframes in them, I have some Javascript code in another page in one of the iframes that when activated, will change the page within the other iframe. The code I have throws the following error:

'null' is null or not an object

and it is complaning abou the following bit of code:

var obj = document.getElementById("frame2");
obj.src = new_src;

But I am not sure if the code is the correct code anyway. Can anyone assist please?
Please find below my complete code, hopefully you can spot what's going on. Here is my 'index.htm' file: Code:

View 2 Replies View Related

Iframes And Javascript

Mar 12, 2002

I'm starting to use some iframes in a div layer. I want to know if i can use javascript to change the size of the iframe (from the parent page containing the iframe).

In IE i can use 100% width and height to fit the iframe to the layer, but in Netscape 6 the iframe doesn't appear if the height is set in % values - hence the need to be able to specify it dynamically as the layer wil change size.

View 1 Replies View Related

Changing Iframes With Javascript

Jul 4, 2006

I have bigpage.html that has the text "click" in it. Also, it contains the iframe small.html.

In small.html there is the text "visible"

How do you get it so that when you click on "click", "visible" changes from black(default) to red?

View 1 Replies View Related

Create Iframes Using Cookies And Javascript

Oct 24, 2010

is there a way to create iframes using cookies and javascript? What i need to do is to have a way to create a cookie on page one, and use the info on page two to create the iframe.Users will see a list of "external links", once they click on a link, they will be redirected to a page that will generate a iframe of the chosen link.My guess is that if there is a way, it must need to use cookies to store the info (url) to get used by the script that will create the iframe on the page that will be used to show all iframes.

View 1 Replies View Related

Access Parent Functions Variables?

Jul 5, 2010

Code...

I am trying to create a simple class in which i want to sent the id of a div to fade in and fade out...

so that i can dynamically change its color width and height with a basic class.

I read about closures but inside jquery this is referring the div notex....

how to access parent functions variables?

View 2 Replies View Related

Access Functions From Parent Html

Aug 19, 2011

I'm new to web programming in general, so bear with me as some of my methods may not be entirely correct. What I currently have working is I have a webpage which contains a DIV, which I am using to load another webpage via javascript(which calls itself, in order to get an auto-refreshing effect). The webpage that's being loaded is detecting if a process is currently running on the server and writing some console output while it's running, and what I want to do is stop the auto-refreshing when the process completes. (I can detect when the process stops already).I'm trying to figure out how to properly set this variable from my page that's being refreshed, since it's being loaded in a DIV I figured there has to be some way to retrieve the parent's information.

View 4 Replies View Related

JQuery :: Functions Not Being Defined From Parent File?

Mar 12, 2009

I have 2 custom JQuery files..Now the sequence in the header of the HTML file is as follows1. Jquery Library2. File 13. File 2The problem im facing is that, file two is not recognizing functions created in file one... ex..

Code:
$(function() {
function say_hi() {

[code]....

View 2 Replies View Related

JQuery :: Negatives To Using So Many Parent - Sibling And Children Type Functions?

Jan 25, 2011

The following function works fine. I was just wondering if there are any serious negatives to using so many parent, sibling and children type functions?

View 1 Replies View Related

Setting Cookies Across Subdomains Or Paths

Jul 23, 2005

I am setting a cookie on a subdomain:
http://store1.mydomain.com

Then the store takes me to a shopping cart that is at:
http://shopping.mydomain.com

Somewhere the following code (taken and modified from The JavaScript Source)
is broken between domains, because when I click my "store" link that should
read the cookie and send me to store1.mydomain.com or storeN.mydomain.com I
get the default template store.

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ronnie T. Moore -->
<!-- Web Site: The JavaScript Source -->

<!-- Begin
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
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 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 DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var favorite = GetCookie('store');

if (favorite != null) {
switch (favorite) {
case 'store1' : url = 'http://store1.mydomain.com/'
break;
case 'store2' : url = 'http://store2.mydomain.com/'
break;
case 'store3' : url ='http://store3.mydomain.com/'
break;
case 'storeN' : url = 'http://storeN.mydomain.com/'
break;
}
window.location.href = url;
}
// End -->
</script>
</HEAD>

The cookie is set by a javascript "onload command" Like I said I have it
working on a server with no sub domain.

View 1 Replies View Related

Image Object Src Not Accepting Absolute Paths?

Jul 9, 2010

My page accepts a url with various parameters passed in querystring. One of the parameter is the URL of the Image I wish to display on the page. I save this URL in a variable "imagesource"

To ensure the image is not bigger than the size permitted, I use image object to get the height and width of the image.

Now here's my code:

function foo(){
......
var imagesource = URL of the image;
....
var newImg = new Image();

[Code]....

View 4 Replies View Related

Image Paths Inside - Insert A Slide Show Into A Page

Nov 20, 2009

Although I have done a fair bit of html coding after taking several HTML courses, I have never become involved in JavaScript beyond adding the occasional pre-made script for a particular function.

Which is what I am trying to do at the moment. I want to insert a slide show into a page and have tried 2 scripts from Java Kit Scripts. Both are similar and I am having the same problem with both.

The problem: Inserting the image path. They both ask for the image path (naturally) and give the following examples:

Example 1:

Example 2:

But there is no reference to an "image" folder. I have tried inserting the folder name: "images/iss-bunker-1tn.jpg",

I have also tried leaving the word "images" out and also tried saving the related images in the same folder as the html coded pages. I have also tried using "shtml" pages. But nothing seems to work.

View 3 Replies View Related

Javascript Functions

Jul 23, 2005

I am learning HTML for the first time taking a self teaching class
though my local Community College. Normally this college rocks and has
some of the best resources and down to earth teachers that pick books
that acutally help folks.

Well they failed and my book take more logic jumps that Stephen
Hawkins! :D

So my ultimate question is as follows:

How do I created a function with the following information provided:

Create a fucntion named Mquote that contains the single parameter,
Qnum.

My apologies for such little information. I am sure its my oversight
that I am unable to locate the answer to my question.

What I am looking for is the base layout for noob java functions.

View 7 Replies View Related

ParamArrays In JavaScript Functions Possible?

Apr 18, 2006

Can javascript functions have variable number of arguments - a concept
known as paramarrays?

View 15 Replies View Related

Javascript Functions With Xslt

Sep 21, 2007

I have some javascript functions in an xslt file. Everything works and produces the desired html, except when using the visual studio debugger which gives the error "objects of type 'Script1' do not have such a member" and references the line and column where the "this" object is used, as in this.hourarray()

View 1 Replies View Related

Javascript Functions And Links

Dec 18, 2001

I wrote a funtion for all my <a href=...> tags. If I use the function, it looks like this:
<a href="test.html" onFocus="myfunction()">

What I want is to automatically add myfunction() to all the links on a page. So I don't want to add onFocus=blablabla each time when I link to another page.

View 5 Replies View Related

JavaScript Nested Functions

Jan 30, 2007

I have this code:

Code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script language="javascript" >
function outer(data)
{
var operand1 = data;
function inner(operand2)
{
alert(operand1 + operand2)
}
}

</script>
<body>
//<input type="button" value="1" onclick="outer(3)(2)" />
//<input type="button" value="2" onclick="outer(3)(2)" />
<div id="target"></div>
</body>
</html>

How do I call the inner function and pass operand?

View 2 Replies View Related

Calling Javascript Functions From Applet

Jul 23, 2005

We have an applet that has to support the SUN VMs as well as the MS VM.
The applet receives updates from a server (via tcp or http) and wraps them
up as objects and passes them using the JSObject scripting context to a
javascript function.

This function takes the object and reads the properties and updates a
screen.

All seems simple stuff. The problem is that the MS JVM runs like a rocket,
but the sun vm seems to max out our processor and also takes ages to process
anything.

I have tried logging from the console using debug level 5, and it shows a
lot of back and forth between the applet and the javascript when accessing
methods on the object passed.

Seeing that as a possible problem, I now pass a delimited string to the
front end, and then convert that into an update message purely in javascript
so there is only one hit to the applet per message.

I am still seeing a massive difference between the sun and ms VMs.

Has anyone ever come across this, and is there anything I can do to help
flatten out this performance?

View 1 Replies View Related

Recreated Vbscript Functions For Use In JavaScript

Sep 23, 2005

Here is a compilation/creation/collection of recreated vbscript functions for use in JavaScript. Additions and criticism are of course welcome.

Zip file contains:

vbs.js
ReadMe.html

<Edit>Surprisingly there haven't been many downloads for this. Here's a quick overview of the contents:</Edit>

==================================================
==================================================

CreateObject(x)
Translates into: new ActiveXObject(x)

dateDiff(p_Interval, p_Date1, p_Date2,p_firstdayofweek, p_firstweekofyear)
Returns the number of intervals between two dates

datePart(p_Interval, p_Date,p_firstdayofweek, p_firstweekofyear)
Returns the specified part of a given date.

FormatCurrency(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits)

FormatDateTime(datetime, FormatType)

FormatNumber(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits)

FormatPercent(Expression, NumDigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers, GroupDigits)

InStr(strSearch,charSearchFor)
Returns the first location a substring SearchForStr that was found in the string str

isDate(p_Expression)

Left(string, length)
Returns a specified number of characters from the left side of a string.

Len(str)
Returns the number of characters in a string.

LTrim(str)
Returns a copy of a string without leading spaces.

Mid(str,start,len)
Returns a specified number of characters from a string.
monthName(p_Date, p_abbreviate)

Now()
Returns the current date and time.

Right(string, length)
Returns a specified number of characters from the right side of a string

RTrim(string)
Returns a copy of a string without trailing spaces.

Trim(strInput)
Removes leading and trailing spaces

weekdayName(p_Date, p_abbreviate)

================================================
================================================

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved