SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    createElement Iframe frameBorder

    When creating an Iframe element in Internet explorer, and setting frameborder to 0, it doesn't actually set the frameborder, I think it may have something to do with the case sensitivity of frameborder, but I've tried a lot of things.

    Works in Mozilla. Any ideas?
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right after I posted this I decided to try setting the frameborder before appending it to the document, and that worked.

    I am happy now
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  3. #3
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for helping yoursel out, Jeff.

    You may be interested in this: it's a function I used to abstract the creation of elements. The 2nd parameter receives and object, for which I use the literal syntax, typically
    Code:
    document.createHTMLElement = function( elemName, attribs )
    {
    	if ( document.createElementNS )
    	{
    		var elem = document.createElementNS( "http://www.w3.org/1999/xhtml", elemName );
    		var isNamespaced = true;
    	} else {
    		var elem = document.createElement( elemName );
    		var isNamespaced = false;
    	}
    	if ( typeof attribs != 'undefined' )
    	{
    		for ( var i in attribs )
    		{
    			switch ( true )
    			{
    				case ( i == 'text' )  : elem.appendChild( document.createTextNode( attribs[i] ) ); break;
    				case ( i == 'class' ) : elem.className = attribs[i]; break;
    				default : 
    					if ( isNamespaced )
    					{
    						elem.setAttributeNS( "http://www.w3.org/1999/xhtml", i, '' );
    					} else {
    						elem.setAttribute( i, '' );
    					}
    					elem[i] = attribs[i];
    			}
    		}
    	}
    	return elem;
    }
    Example usage
    Code:
    var iframe = document.createHTMLElement( "iframe", { src: "http://www.peterbailey.net", frameborder: 0 } );
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  4. #4
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually have that code saved from you from a while ago .

    Haven't really used it as of yet though.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  5. #5
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh. Oops. Carry on then, good lad
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





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
  •