I have just created an 'open window' function for an animated page. It opens the current animation from the current page into a new window, and lets the user change the 'opener' animation while the new animation in the new window continues, sychronised with the opener.
As the opener contains the clock for sychronisation, I can only use the animations from that page (and I have a few pages of small animations). I can let the new animation on the new page continue with its own clock if the opener is closed, but what I would like is if a new animation is started from a new opener, then it tells the existing opened window the new page speed...
got it?????
trymy rhythm pages
follow steps.....
1; open new window
2; click on drum in new window to turn on
3; start rhythm by clicking on hands in main window
I can change between rhythms, so long as I stay on the main page. The problem is when I change the main page to go to other rhythms I loose the sychronisation.
I can go to another page(from opener) and put a new rhythm in the current new window, but I would prefer to keep the old rhythm and sychronise.
I see how the window.opener works, pretty neat in that the pop window knows the parent.
Is there a property that also knows the form field parent?
My function does not know which of the 3 select menus called it.
What can I do?
function onCarrierSelect() { // var frm = document.carrRequestForm.carrierList.selectedIndex var selectCar = document.carrRequestForm.carrierList.options[frm].text; alert(selectCar); if (window.opener && !window.opener.close) window.opener.document.form(x how make global?).nbcarrier(x how make global?).value = selectCar window.close(); }
p.s. as an aside I know the form field name, it is literally in the querystring, but that is ASP/vbscript and no way to get it into the jscript function...
I wish to access several pictures on my page by defining them as an array. This way I can either loop through them or access them by array index.
What I am really doing is writing my own picture gallery and slide show. The reason I am doing this is so that I can have my web page look exactly the way I want. In addition, it is an excellent way to learn Javascript.
I have the following code that works in FF but no IE:[code]This is a variable that is used in a js slideshow. The text doesn't change with the image in IE.
Code: function initArray() { this.length = initArray.arguments.length; for (var i = 0; i < this.length; i++) {[code].....
For the above piece of code, does the function 'function initArray()' just predefine the array that is written right after so that it's first array index starts at 1 instead of 0?
I have built a function that allows users to select a color tile and trim option for a cooking range. Here is a code snippet showing the function:
var color, trim, description; function displayRange(selectColor, selectTrim, showDes) { var rangeName; if (selectColor != '') color = selectColor; if (selectTrim != '') trim = selectTrim; rangeName = "images/cluny1400" + color; if (trim == 'chrome') rangeName += "_chrome"; rangeName += ".jpg";
var rangeDescription; if (showDes != '') description = showDes; rangeDescription = description; document.getElementById('rangePict').src = rangeName; document.getElementById('rangeDes').innerHTML = rangeDescription; }
Based on the users selections the range image in the selected color and trim is loaded into the interface. My problem is this:
The selected image is made up of three elements, based on the users selection, color and trim and the .jpg extension. This function works well.
However, I cannot work out how to use the image object to preload the images (of which there will be over 34). Normally you would assing a var to hold a new instance of the image object and then assign the src property to the image url. But how do I do that when the var rangeName is composed of three elements. I cannot use a simple var and then call that var in the function.
I have this code snippet, that illustrates my problem:
// create function to preload images // eliminate older browsers by checking for image object support function preload() { if (document.images) { cluny1400au = new Image(478, 314); cluny1400au.src = "images/cluny1400au_fw.jpg"; cluny1400au_fw_chrome = new Image(478, 314); cluny1400au_fw_chrome.src = "images/cluny1400au_fw_chrome.jpg"; } }
The vars cluny1400au and cluny1400au_fw_chrome would be fine if I could use them in the function to call the images, but I don't think this will work as I believe that you have to use the same var name in the function as in the image object.
Can anyone tell me how the cluny1400au = new Image(478, 314); and cluny1400au_fw_chrome.src = "images/cluny1400au_fw_chrome.jpg"; should be constructed to work with the function.
Here is an html snippet from the page to aid clarity:
I would like to have an array and define which element goes to what key. Something like this: Code: var test = [][]; test[0][0] = "foo"; test[0][1] = "bar";
However I am wondering if its possible to write it in one statement? Something like this: Code: var test[0] = [ [0] => "foo", [1] => "bar" ]; The code up doesn't work of course.
var category_list = document.getElementById('category_list'); var dom_div = document.createElement('div'); dom_div.id = 'content' var dom_link = document.createElement('a'); dom_link.href ='#' dom_link.onclick = displayDiv(); val = document.createTextNode('Click'); dom_link.appendChild(val); dom_div.appendChild(dom_link); category_list.appendChild(dom_div);
The displayDiv Funcion
function displayDiv() { dv = document.getElementById('content'); //Here is the error. }
The Problem is when the following script:
dom_link.onclick = displayDiv('content'); is executed it is calling the function displayDiv(name) Here we have the code document.getElementById('content'); which throws the error.
The reason is the div container is not yet created.
What I need is the function should be called only on the click event. It should not be called while I define it to the Click Event. (ie it should not be called at the time of defining) How to achieve this.
How can I dynamically specify a class value to use in a selector? For instance, I have a number, and I need to identify an element that ends with that number. In this case, there are four divs that have class values of
my_id_0 my_id_1 my_id_2 my_id_3
I have a 0 (obtained previously in the code) stored in the value tabId, so I want to get the values of the class attribute for <div id="my_id_0">. How do I create my selector? I tried
I'm trying to define a selector as a global variable and it keeps coming back undefined. I tried creating a namespace for it but had no luck. I would like to be able to reference the sliderRange, currentMin, currentMax globally.
I'm trying to code a script that will display an approximate postage price based on different combinations of variables, but the numbers I defined for each case aren't reflected in the text box. I'm using a switch statement for all the different combinations of options, which the user will choose by selecting check-boxes. (Additionally, I know that this code probably isn't a very efficient way of doing what I'm doing - how to improve it.) I've attached all the relevant parts of the code, including how I defined variables originally.
<script type="text/javascript"> function count(){ var firstclass = document.calc.firstclass.value; var postcard = document.calc.firstclass.value; var numpages = document.calc.numpages.value; var nms = document.calc.nms.value; var large = document.calc.large.value; var numpages = parseInt(document.calc.numpages.value); .....
If i open a link either by using the right mouse menu "open in new window" or press shift (IE) on the link the page will be opened in a new window. From this window I can use the window.opener object to access the opening window.
When doing this in NN7.1 I cannot access windows.opener. If I open the window with window.open I can also use the window.opener to access the opening window but not if I open the new window by pressing CTRL an clicking the link or using right click "Open link in new window".
Is it only possible to access the window.opener if the window was opened with window.open in NN7?
I have a normal window cotaining a form (named form1). The form has a text input called imageURL. There is a button that, when clicked, opens a new window that contains three frames (left, right and bottom.) In the right frame is another form (named form2) with a hidden input (selected). When form2 is submitted, I want the value of selected to be passed back to the imageURL on form1 and then close. The code I have tried is as follows:
(From my frame...) <SCRIPT language="JavaScript"> function passValues() { // pass variable back to parent window window.opener.document.form1.imageURL.value = document.form2.selected.value; } top.window.close(); </SCRIPT>
It closes just fine, but imageURL on form1 never changes.
How do I get the contents of an element in the opener and show them in the child?
What I'm trying to do is something like this:
In the opener: <h1 id="pgtitle">Office XP</h1>
In the child: function gt_pageCont () { var pagetitle = window.opener.document.getElementById("pgtitle"); var pagetext = "<h1>""+title+""</h1><p>Here are some more info about "" +title+ "".</p>"; document.write(pagetext); }
and: <body onload="gt_pageCont();">
I know that something is missing in the function, because I've tested it and the child displays [Object] instead of "Office XP".
I have a popup which contains a frame set; one of the frames contains a form. When the form is submitted, I want it to go back to the opener of the popup. I have:
document.forms[0].target = parent.opener;
But on submit it opens a new window. If I put:
document.write(parent.opener.name);
it gives me the correct value, so I know I'm pointing to the right place. Any idea why this doesn't work and/or how to get it to?
I've got a problem calling parent.opener.document within Internet Explorer version 6.0.2900.2180.xpsp.050928-1517. The call leads to a script error 'Unallowed memory access'. Within older IE version and other browsers it works fine.....
We have a micro site that is getting opened inside a popup window from some external main site (the domains of our microsite and main site are different) ...
I need to support the following functionality: After the user is done surfing the pages on our site and user clicks the close hyperlink (present on top of all of our webpages), the opener window's location needs to be reset to some given URL ....
I had a small javascript code for this, where i have written: window.opener.location.assign("<url>"); .
My problem is that this line of code is throwing an exception saying "Permission denied to access method location.assign" ...
Can anybody help me and let me know why am I getting this exception? and how to overcome this problem?
The use of jQuery below does not work for IE9 but works beautifully for Firefox, Chrome & Safari. Before I rewrite it without jQuery, I was hoping to get some feedback on what I've done. Not certain about standards compliance, just know it works fine for all the browsers I'm testing except IE.The user provides an action from a popup window. The action references the opener window, removes a few elements from a hidden element and then immediately repopulates those elements with updated values based on that action.
Code JavaScript: // does not appear work like this in IE9 window.opener.$('div#hiddenShiftAbbrList').empty();[code].....