Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 02-12-2003, 04:57 PM   PM User | #1
florida
Regular Coder

 
Join Date: Jul 2002
Posts: 346
Thanks: 0
Thanked 0 Times in 0 Posts
florida is an unknown quantity at this point
Getting a function to work in a layer.

I have a form in Netscape 4 that calls a Javascript Function and it works great but after I put in the <ilayer> it seems to ignore the onSubmit return myFunction. Basically after I add the <ilayer> it eliminates the onSubmit "MyFunction" part. Is there something I can do to get "myFunction" to work in the <ilayer>??

<ilayer=l1>
<form name="mypage" action="otherpage.html" onSubmit="return myFunction();">

//form stuff

</form>
</ilayer>
florida is offline   Reply With Quote
Old 02-12-2003, 05:45 PM   PM User | #2
ScottInTexas
Regular Coder

 
Join Date: Nov 2002
Posts: 518
Thanks: 2
Thanked 4 Times in 4 Posts
ScottInTexas is on a distinguished road
Try using parent.MyFunction(). It worked for me in this case.

objFrame.document.write('<input type="button" id="printit" value="Print Table" onclick="parent.doPrint()">');

When the button is on the screen it is inside a separate frame and I needed to point to the parent in order for the button to see the doPrint function.
__________________
Scott Stewart
Always happy to learn from pros.
ScottInTexas is offline   Reply With Quote
Old 02-12-2003, 06:56 PM   PM User | #3
florida
Regular Coder

 
Join Date: Jul 2002
Posts: 346
Thanks: 0
Thanked 0 Times in 0 Posts
florida is an unknown quantity at this point
I tried this and it still doesnt work. Please verify if I have everything correct? Is objFrame and parent suppose to be specific page names??
Anymore advise?

<ilayer=l1>
<form name="mypage" action="otherpage.html">

<script>
objFrame.document.write('<input type="button" id="myid" value="my id value" onclick="parent.myFunction()">');</script>
//form stuff

</form>
</ilayer>









objFrame.document.write('<input type="button" id="printit" value="Print Table" onclick="parent.doPrint()">');
florida is offline   Reply With Quote
Old 02-13-2003, 03:26 PM   PM User | #4
ScottInTexas
Regular Coder

 
Join Date: Nov 2002
Posts: 518
Thanks: 2
Thanked 4 Times in 4 Posts
ScottInTexas is on a distinguished road
What kind of error are you getting? Or is it just not doing anything? Did you put an alert in your function to see if it is being called? Also, your function may not be in the iLayer's parent and I don't think bubbling works in Netscape (commands keep moving up the tree until they find the function). You can try using top to get to the function definition i.e. onClick=top.MyFunction();.


I know how frustrating it can be. I hope that something I write can be useful in your quest for control over you page.
__________________
Scott Stewart
Always happy to learn from pros.
ScottInTexas is offline   Reply With Quote
Old 02-13-2003, 07:04 PM   PM User | #5
florida
Regular Coder

 
Join Date: Jul 2002
Posts: 346
Thanks: 0
Thanked 0 Times in 0 Posts
florida is an unknown quantity at this point
It doesnt seem to acknowledge my function (which checks for blank entries) and will let blank entries go through. My main question is how I can get the "onClick" to work using <ilayer>. The onClick will not work with anything I put in their as long as I am using <ilayer> BUT works great if I get rid of my <ilayer>. I tried "top.myfunction" and still no luck.
florida is offline   Reply With Quote
Old 02-13-2003, 08:36 PM   PM User | #6
ScottInTexas
Regular Coder

 
Join Date: Nov 2002
Posts: 518
Thanks: 2
Thanked 4 Times in 4 Posts
ScottInTexas is on a distinguished road
Sorry Florida, I'm all tapped out. I can't think of anything else. Good luck.
__________________
Scott Stewart
Always happy to learn from pros.
ScottInTexas is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:13 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.