Iframe Window.location As A Global Variable - String

Oct 18, 2010

I have come up with form which pulls membership id, allows checkbox selections and commentry (custom feedback). The final piece that needs to be captured is the iframe's url. Now the content in the iframe is content produced by (madcap) flare.

I need to capture the window.location of the iframe url and pass that onto the asp.net masterpage. The iframe is also located in a content page. The iframes content is controlled by it's own TOC. I have added a script to this output so that each time the content (page) in the iframe changes the script alert's me of the new URL of the page just clicked/opened (this is the information I need passed as a variable).

Here is the code producing the desired alert output (page url).

Code:

The above produces the output I would like to capture (but instead of an alert output, I require this as a string) which will allow the insertion into my form as the final piece of information required.

I am not sure how I can convert or catch the output. Of course I would not want to use the alert function everytime the page changes, but would like to have the window.location bound to a string which I can then use when inserting into my codebehind sql statement.

All the captured data is being inserted using vb.net into a sql table.

I just need to make that content page > iframe (window.location) a global variable that my masterpages codebehind can inject into the INSERT SQL statement.

View 11 Replies


ADVERTISEMENT

Clear Global Variable When Reopen Window?

Dec 9, 2010

when I click "Markera alla bilder" (select all pics) only half get checked. Why? when I chose pictures, go to slideshow ("visa bildspel" button), close that window and click the "visa bildspel" button again, the first pictures are still there... How do I get rid of them without having to refresh the first window?

Here is the code for first window:

/.../
<script type="text/javascript" language="javascript">
var windVar = null;

[code]...

View 2 Replies View Related

Window Location In An IFRAME

Jul 23, 2005

i have the following script:

function subCat(){
var d = document.all;
var i = d.sid.value;
if(i != "-1"){
window.location = "subcat.php?sid="+i;
}
}

That is called on the following drop down menu:
<select name="sid" class="dropBox" id="sid" onChange="javascript:subCat()">
<option value="-1">Please Select</option>
<option value="1">category 1</option>
<option value="2">category 2</option>
<option value="3">category 3</option>
<option value="4">category 4</option>
</select>

It works fine in IE but not in Mozilla Firefox, what do i need to chnage to
make it work correctly?

View 2 Replies View Related

Target Window.location.href To Iframe On New Page

Jun 15, 2010

I know next to nothing about javascript and I don't even know if this is possible. I need to target window.location.href to an iframe on a different page. So, right now, the piece of the code that redirects the browser looks like this: window.location.href='http://www.somewhere.com/'; Works great, brings it up in the same browser window. So now I need to modify the code so it goes to a different page and brings that page up in a specified iframe.

View 6 Replies View Related

IFrame-name.location Problem Redirect Parent Window

May 5, 2006

After executing the iFrame-name.location=url (which worked fine by way,) there is a very undesirable event; the parent window also gets redirected to the same url.:mad: I am calling this function from a click event on an Image object. I have tried everything from return(false); to window.event.cancelBubble = true; nothing stops the parent window from navigating. The interesting thing is, if I hit the Back button it goes back and still redirect the parent window automatically, over and over.

The odd thing is I have identical code in another project and I never had problems.

Here is a portion of my javascript func:

function clicked_SubmitScreensBtn() {

var url = "ovExplorer.asp?Action=show&QData=BLABLABLA";
var iFrDoc = document.frames("ifrmOVExplorer").document;

iFrDoc.location.replace(url);

window.event.cancelBubble = true;
return(false);
}

And this is my iFrame in the HTML of the parent window:

<iframe name="ifrmOVExplorer" id="ifrmOVExplorerID" src="blank.htm" style="Z-INDEX: 10; VISIBILITY: visible; POSITION: absolute; LEFT: 22; TOP: 380; WIDTH: 306px; HEIGHT: 280px;" marginwidth="1" marginheight="1" align="left" border="0" frameborder="0" scrolling="no">
</iframe>

View 1 Replies View Related

Passing A Variable To Window.location.replace?

Aug 14, 2010

this is a newbie question, and probably really dumb, but If I create a function that looks like this...

function recall(tim)
{
setTimeout("window.location.replace('somepage.html')",tim);
}

it works fine when called. However; I want to be able to pass the page url in a variable, something like this.

[Code]...

View 3 Replies View Related

Pass Value With A Variable In Window.location Not Working In Firefox

May 6, 2011

I have this [code]...

It works perfectly fine in IE but it won't work in firefox. Both link and var does not appear in the URL when I get to index.php.

Can anyone explain why? How is it not working in firefox?

View 1 Replies View Related

JQuery :: $.url() Function - Being Utilized For Parsing Out The Window.location Or Window.location.search Parameters

Feb 14, 2010

Danged if I can find the thread, but I swear I saw a $.url() reference in here a day or two ago. It was beingutilized for parsing out the window.location or window.location.search parameters. I made a mental note because that was something I would be needing to do.

Now I can't find it, either because the search isn't finding it or I was dreaming about this function existing.

I rummaged about the API docs and didn't find it there either. Is it something provided by one of the plugins and not a function native to jQuery?

View 3 Replies View Related

Get Parent String Variable In Child Window?

Jan 21, 2010

I'm looking for a way to get a variable from a parent window in a child window. I'm aware that you can write the variable to a hidden field and then get the field's value in the child window, but I'm looking for a cleaner (all JS preferable) way of doing this.

Something like this, but I believe this is an out-dated solution code...

View 2 Replies View Related

Global Variable Glitch - Can Only Access The Variable On The Second Call

Dec 9, 2011

I am simply trying to use a global variable in javascript, but can only access the variable on the second call. I can't find anything that relates to this through my searches. My application is supposed to query the server for XML that tells me which years and months are available to put into combo boxes. I want to store this xml in a global variable to access it later.

[Code]....

View 6 Replies View Related

Set Time As Variable Or Global Variable?

Sep 6, 2011

I am creating a survey. I want to set a variable, which is sent to google analytics, as the current time. this is the code and works fine:

HTML Code:
<script type="text/javascript">
<!--
var d1 = new Date();
var curr_date = d1.getDate();
var curr_month = d1.getMonth();

[Code]...

View 1 Replies View Related

Global String Replacement (was Regular Expression)

Oct 12, 2011

I have just spent a while searching how to use regular expression to strip out spaces in a string and replace them with ',' I don't seem to be getting anywhere and was hoping someone could explain how to do it.

So for example:

Mystring = "a b c d"

My string would end up looking like the following

Mystring = "A','b','c','d"

View 1 Replies View Related

Global Variable

Jul 20, 2005

If I have a global variable in one <SCRIPT>...</script>, is it available in the 2nd <SCRIPT>...</script>. I do not know if "global" means the whole document or the whole <SCRIPT>...</script> only.

View 3 Replies View Related

Eliminating A Global Variable

Jul 23, 2005

I've created a site where the pages generally contain a table of
contents (site map) down the left side. When each page loads, the
first function is called. The second function populates a global var
(array) of all the links.

I try to avoid using global variables, but I am stumped how to
eliminate this one (TocLinks) because other functions need to iterate
through it. I think the answer is to create a custom object that the
other functions can access. But I need some pointers on how to
proceed.

Here's the function that the pages call initially and the 2nd function
that it calls:

View 1 Replies View Related

Global Variable Does Not Want To Change...

Nov 8, 2006

I have a global variable which does not want to change :
<header>
....
<script type="text/javascript" language="JavaScript">
var i=1;
function swap()
{
var window.i = 1 - window.i ;
}
.....
</script>
....
<body>

<A href="" ... onclick="swap()"<img src="pix/star.gif" </A>

when clicking on 'star.gif', i does not change from 1 to 0 ...

Any clue ?

View 4 Replies View Related

Global Variable In A Function

Jul 20, 2005

I have a .js file that receives a value from an html page. I'd like this
value to be a global variable that all functions in the .js file can use. I
have tried just declaring a var at the top of my .js file, but when the
value comes into the function and gets assigned to that variable, it is not
global.

View 4 Replies View Related

Global Variable - Why Is It Undefined?

Aug 28, 2009

I code my global variables first, then my window.onload function, like this code...

Why do I get the error:

"KBINPUT IS NOT DEFINED"?

and

Why doesn't the IF statement for UNDEFINED element catch the problem?

View 2 Replies View Related

Passing Value To Global Variable?

Mar 15, 2009

I have a site that calls the function welcome() and displays a prompt. The same site also has an iframe that calls the next function, add_name(), but when the pages are loaded it says that "answer" is undefined.It says on the page, where the <p id="guest"></p> is, "Welcome undefined". How do I make it so that the value of answer, which is given onLoad of the 1st page with the prompt, is displayed as text in function add_name()?

[CODE]
function welcome(){
var x = document.getElementById("body");

[code]....

View 4 Replies View Related

Undefined Variable (global?)

Sep 21, 2006

I'm currently coding the beginnings of a stopwatch script.

<html>
<head>
<script type="text/javascript">
var startTime;
var currentTime;
var started = 0;

function startStopwatch() {
if (started == 0) {
var startTime = new Date();
display();
alert(startTime);
}
}

function display() {
currentTime = new Date();
difference = (Number(currentTime) - Number(startTime));
document.stopwatch.display.value = difference;
setTimeout('display()',10)
}

</script>
</head>
<body>
<form name="stopwatch">
<input type="text" name="display" readonly="readonly" size="40">
<input type="button" name="start" value="Start" onclick="startStopwatch();">
<input type="button" name="stop" value="Stop">
<input type="button" name="reset" value="Reset">
</form>
</body>
</html>

The value of startTime when called from display() is undefined. I'm not sure why, as I declared the variable outside the function. The variable should be accessible by all functions, right?

Any help would be appreciated.

View 5 Replies View Related

Global Variable Not Changing Value

Oct 2, 2010

I have two pages. In one page I am changing the value of a variable called t, in the other I am outputting it. The problem I'm having is in changing its value.

[Code]....

View 1 Replies View Related

Global Variable Only If A Condition Is Met

Aug 2, 2010

I wish to declare a global variable, but only if a certain condition is met. For example:

Code:

Except that now it is not global because it is contained within an if statement.

View 3 Replies View Related

Global Replace - Make A Function To Strip A String Of All Slashes

Nov 7, 2009

I'm trying to make a function to strip a string of all slashes. Initially I had:

Code:
String.prototype.stripSlashes = function ()
{
return this.replace('\','');
}

and that worked fine except it only replaced the first slash (which it apparently is supposed to do). So i read up about global replacements but cant seem to get the right combination of /s and s.
This is what i have at the moment:

[Code]...

View 3 Replies View Related

How To Build A Reference To A Global Variable

Jul 23, 2005

I declare multiple variables halfway down the page. The number between "mech" and "Num" is generated dynamically in the XSL. Later on I need to reference that variable in a function, but I need to build the variable name in script. How do I convert it from a string reference to a ref to the global variable?

function changePreference(pos,mt){
//mt does not reference mech2Num, I need it to.
}
changePreference(2,'my' + pos + 'Num');

var mech1Num=1|2|3|4|5|6;
var mech2Num=1|2|3|4|5|6;
var mech3Num=1|2|3|4|5|6;

View 7 Replies View Related

Can I Assign An Event To A Global Variable?

Oct 4, 2007

I was wondering if anyone knew if/how to assign an event to
a global variable?

I tried to do it and IE 7 came back with an error saying "Member not
found"
My code looked similar to the following:

var globalEvevnt;
function showPopup(event){
globalEvent = event;
alert(globalEvent.type);
setTimeout(function(){unhideDiv()}, 2000 );

}

function unhideDiv(){
alert(globalEvent.type); //Member not found error found on this
line
}

I was wondering if I had declared the globalEvent = new Object();
would that make any difference? I thought everything in JS was an
object so the event could be stored to one as well?

View 6 Replies View Related

JQuery :: Does $variableName Mean Global Variable

Mar 23, 2010

use this kind of syntax in an open source plugin.#varableName = someMethod(); that someMethod return an object instance.Then I can access that object outside that plugin. Is this a standard javascript global variable or some jQuery feature?

View 4 Replies View Related

Not Able To Access Global Variable / Enable This?

Apr 3, 2010

I'm trying to populate a web page with javascript. I have 2 functions. One that runs on-load so I can populate a dropdown list. The second one to process the selection when the user selects an item from the list.

I have a global variable in the top of my javascript that I use in the functions and as long as I set it in it's global scope, everything works fine. But what I really want to do is to pass this into the javascript running on this page via the code...

My question is. Where do I put this code so that I can use it to set the global variable "weekNumber"?

I've tried putting this code in the populateList function - NOPE! I've tried referencing it via window.weekNumber and this.weekNumber - NOPE. I'm stumped.

I've spent far too many hours trying to understand this without success. Can anyone help me figure out where to put this code so I can set the global variable weekNumber?

Is there a better way to do this?

View 2 Replies View Related







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