![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
Regular Coder ![]() Join Date: Jul 2002
Posts: 346
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
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> |
|
|
|
|
|
PM User | #2 |
|
Regular Coder ![]() Join Date: Nov 2002
Posts: 518
Thanks: 2
Thanked 4 Times in 4 Posts
![]() |
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. |
|
|
|
|
|
PM User | #3 |
|
Regular Coder ![]() Join Date: Jul 2002
Posts: 346
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
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()">'); |
|
|
|
|
|
PM User | #4 |
|
Regular Coder ![]() Join Date: Nov 2002
Posts: 518
Thanks: 2
Thanked 4 Times in 4 Posts
![]() |
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. |
|
|
|
|
|
PM User | #5 |
|
Regular Coder ![]() Join Date: Jul 2002
Posts: 346
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
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.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Rate This Thread | |
|
|