Closed Thread Icon

Topic awaiting preservation: Executing Javascript in an iFrame (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8721" title="Pages that link to Topic awaiting preservation: Executing Javascript in an iFrame (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Executing Javascript in an iFrame <span class="small">(Page 1 of 1)</span>\

 
Kaniz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 06-16-2003 16:57

On the webpage I am currently working on. I have a calander displayed in an iFrame, and the controls for next/back in the main page (outside of the iframe), and when the user clicks on a date in the frame it opens up a pop up window filling it in with relevent information.

This is all working fine and dandy in IE. No errors or problems, the world is a happy place.

Enter Netscape, as much as I'd love to say screw netscape, a large portion of the clients that goto this page (or will be going to), are netscape users (I dont have the exact numbers, but sizeable enough to make it worth my effort to fix).

Anyways, I currently have

code:
<iframe name=cal src="./test.asp"></iframe>
<span onClick ="this.document.cal.doClick(whatMonth(-1));"> Last </span>
<span onClick ="this.document.cal.doClick(whatMonth(1));"> Next </span>



and in test.asp, the doClick is

code:
function doClick(nextMonth) {
document.monthCal.changeMonth.value = nextMonth;
document.monthCal.doAction.value = "displayMonth";
document.monthCal.submit();
}



Basicly, the calander is a form with a bunch of hidden input box's to hold information and is generated with ASP and connected upto a database.

Anywho, how do I get it so a click on next/last in the parent frame will execute javascript in the iframe?

Currently, clicking on a date in the iframe executes javascript in the parent frame, that works fine. Just going the other way around is giving me issues.

Kaniz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 06-16-2003 17:56

More details.

In my whatMonth(...) function, I have

code:
function whatMonth(dir)
{

switch(cal.monthCal.curMonth.value)
{
<%
dim y
..
..
}



and netscape is giving the error

quote:
Error: cal.monthCal has no properties
Source File: http://sylvio/calcontrol/test-1.asp
Line: 207



any ideas how I can get NS to recgonize the values of cal.monthCal (monthCal is a form inside of the inframe)

Kaniz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 06-16-2003 19:04

Got it fixed. Added a function called getCurMonth to cal.asp which returns the current month from that page to the function I needed.

..... but, if you got a better soln' feel free to help

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-16-2003 20:48

hmm I'm a bit confused why this actually works.

myabe I'm missing something, but seems that in this line

<span onClick ="this.document.cal.doClick(whatMonth(-1));"> Last </span>

the "this" should reference the span which should break everything but then again maybe I'm missing something.

All that aside, when using frames like this where there is Javascript within both it is helpfull to start from the "top" object and then drill down to the appropriate frame.

so if the frame contents is what you want to refrence start with top (The main frame)

top.cal.monthCal .....

if you use the top refrence and work your way down the tree then it doesn't matter from which frame you call it from.



.:[ Never resist a perfect moment ]:.

Kaniz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 06-17-2003 22:27

ahh, good point on the span and this .. didnt think about using top and working down that way, better solution and less likely to misteriosuly break I bet.


« BackwardsOnwards »

Show Forum Drop Down Menu