SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist winterheat's Avatar
    Join Date
    Aug 2007
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    pseudo protocol wipes out the whole document even if function doesn't return anything

    I have a page in which

    <a href="javascript:foo()">link</a>

    will cause the whole page be wiped out (blanked out) even if foo() is not returning anything. It merely loops over, say 1 to 10, getElementById, and set the checkbox's state to 0 or 1. And then the function exits without returning anything. Yet, the whole document is wiped out as blank.

    Isn't it only the case when the function return something, such as doing

    return "" or return false; or return "ha" that it can wipe out the whole document? thanks!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    The function returns undefined so the pseudo protocol shows a page of content instead.
    Read more about it in this post:
    http://www.sitepoint.com/forums/show...53#post3925899
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Evangelist winterheat's Avatar
    Join Date
    Aug 2007
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your reply Paul. I think I have seen situations in which not returning anything will cause the page to be just static: nothing changes. But if it is the case of an iframe on IE6 using the new Facebook design, then not returning anything will cause most of the page to blank out.

    In fact... with the new Facebook design on IE6, if I iframe a page, and that page sets a timer (setTimeout) to wait for 3 seconds and changes an empty div's innerHTML to be "hello", then most of the page sudden blanks out... I am still looking into why.

  4. #4
    SitePoint Evangelist winterheat's Avatar
    Join Date
    Aug 2007
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by the way, I wonder if there can be any event that captures the iframe change of state? I even did inside of the iframe:

    document.getElementById("for_my_content").innerHTML = document.getElementById("for_my_content").innerHTML

    then most of the page will blank out.


Bookmarks

Posting Permissions

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