www.webdeveloper.com
Results 1 to 11 of 11

Thread: I tried using onclick to break out of frames and doesn't work.

  1. #1
    Join Date
    Mar 2003
    Posts
    26

    I tried using onclick to break out of frames and doesn't work.

    I had a perfectly good method of breaking out of frames but when I tried to trigger it using onclick the think can not find the object parent.window.realchoices.location. Here is what I did:
    function closeHelp() {
    top.location.href=parent.window.realchoices.location.href;

    }
    "the above is in a set of script tags"
    <a href="javascript://" target="_top" onclick="javascript:closeHelp()" alt="Press alt plus Q and then enter to quit help" accesskey="Q" title="Close" > <img src="x.jpg" width="16" height="16"> </A>
    I tried many variations and it won't work. My original method worked like a dream.
    <a href="javascript:location.href=parent.window.realchoices.location.href" target="_top" alt="Press alt plus Q and then enter to quit help" accesskey="Q" title="Close" > <img src="x.jpg" width="16" height="16"> </A>
    My boss encourgaed me to use onclick but it just won't work. for some reason.

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    You can either use href="javascript:closeHelp()" or onClick="closeHelp()" but onClick="javascript:closeHelp()" is not acceptible.
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  3. #3
    Join Date
    Mar 2003
    Posts
    26
    Yeah, I orignally did that, I just put in onclick="javascript:closeHelp()" just for the hell of it.
    I shouldn't be doing that but sometimes trying everything you can think of really does work. What I put origninally and what i should have kept is
    onclick="closeHelp()" but I assure you it has nothing to do right now with whether it will work not because it doesn't.
    Sorry if I screwed anyone up reviewing my code. Thanks for your help.

  4. #4
    Join Date
    Mar 2003
    Posts
    26
    I brought this up again because I am still having problems with it and I really like to know why it is not working. The javascript works inline as href="javascript:location.href=parent.real_choices.location.href;" but I know that is very bad idea so I instead want to put it in a function.
    <script language="JavaScript1.2" type="text/JavaScript1.2">
    function closehelp() {
    top.window.location.href=parent.real_choices.location.href;

    }
    Then I use onclick.

    <a href="demo.htm" onclick="quit(); return false" title="Close Help ALT Q" accesskey="q" >
    This the code that I keep coming back to and should be the way to do it correct. So can anyone help me please. No matter how hard I try it does not work for me. It seems like the javascript isn't even attempted for some reason it just tries to go to whatever I put in the href. Thanks.

  5. #5
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    <a href="default.htm" onClick="top.location.href=parent.real_choices.location.href; return false;">


    [J]ona
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  6. #6
    Join Date
    Mar 2003
    Posts
    26
    Is there no way to do it in a function. If you know that it won't work and it isn't just me please let me know. Thanks.

  7. #7
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    <script type="text/javascript">
    function redir(){
    top.location.href=parent.real_choices.location.href;
    return false;
    }
    </script>

    <a href="page.html" onClick="redir();"></a>


    [J]ona
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  8. #8
    Join Date
    Mar 2003
    Posts
    26
    I tried you script basically copied everything in there and it still will not work. Even worse I find that if I make it access <a href=" top.location=parent.real_choices.location.href" just as a test and it won't work it ignores the javascript and treats it like a link. I am using ie 6.0 and it is on a IIS5.1 server. It only seems to work when i put out that target is that proper behavior, i havbe had other machines look at it and browsed it on netscape, same behavior. Is this standard behavior because does not sound like it should be. i am desperately trying to figure out if it something wrong with what I have done but I can't see anyway. ANybody tried this exact same thing and it works?

  9. #9
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    <a href="page.html" target="_parent">Break out of frames</a>


    [J]ona
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  10. #10
    Join Date
    Mar 2003
    Posts
    26
    Not exactly what I am looking for. I have broken out of frames before but this one for some reason. I am trying to break out of frames so that I come out in the frame that is on the left. Problem it behaves as described above. SO you are in the right frame and I want set it up so the whole window becomes the left frame. Thanks for the help though, you have been helpful.

  11. #11
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413

    <body onload="if(self.location.href != top.location.href){top.location.href=self.location.href;}">


    [J]ona
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.48649 seconds
  • Memory Usage 2,948KB
  • Queries Executed 13 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (11)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (11)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates