PDA

View Full Version : Getting a function to work in a layer.


florida
02-12-2003, 03:57 PM
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>

ScottInTexas
02-12-2003, 04:45 PM
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.

florida
02-12-2003, 05:56 PM
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()">');

ScottInTexas
02-13-2003, 02:26 PM
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.

florida
02-13-2003, 06:04 PM
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.

ScottInTexas
02-13-2003, 07:36 PM
Sorry Florida, I'm all tapped out. I can't think of anything else. Good luck.