Jump to content
Sign in to follow this  

frames on safari 3 does not work

Recommended Posts

Hi,I have a frame that works on IE 7 but does not work on safari 3.It shows the message like this:TypeError: Value undefined (result of expression top.frames["toolbar"].doSomething2) is not object.Here is the codedefault.htm

<HTML><frameset id="frameset1" rows="119,*" name="frameset1" border="0" frameSpacing="0" frameBorder="no">		<frame name="toolbar" id="toolbar" src="button.htm" marginheight="0" marginwidth="0" scrolling="no" NORESIZE>		<frame name="top_main" id="top_main" src="button2.htm" marginheight="0" marginwidth="0" NORESIZE>	</frameset></HTML>


<html><head><script>function doSomething2(){			document.write("this is my document");}</script></head><body>my page</body></html>


<HTML><script>try{top.frames["toolbar"].doSomething2()}catch(e){alert(e);}</script><body>button2<br /></body></HTML>ThxPlz help

Share this post

Link to post
Share on other sites

:)Sorry, I've missed something.. That's the name 'toolbar' of the frame is a reserved word..You should change it. For example, 'tool_bar'.And please remember that if you execute the script 'doSomething2()', the page may be redirected to another page. So the browser is unable to execute the script again.So I think it is better to create a <span> and use 'innerHTML' to change to text.For example, use the following code for the 'button.htm':

<html><head><script>function doSomething2(){document.all.maintext.innerHTML="this is my document";}</script></head><body><span id="maintext"></span></body></html>

And, you know, when the button2.htm is executed, the function 'doSomething2' will also be executed at once. So I think you should add a button to the page 'button.html':<input type="button" value="Click me!" onclick="java script:functionname()">create a JavaScript function:function functionname(){try{parent.tool_bar.doSomething2()}catch(e){alert(e);}} or directly link to the button.htm like this:<input type="button" value="Click me!" onclick="java script:parent.tool_bar.doSomething2()">Also, I think it is better to use:<script language="JavaScript">instead of<script>I hope it is work for your web page and my code is useful to you! :)(Am I talking too much?)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...