Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-16-2005, 02:57 PM   #1 (permalink)
nefiga
nefiga
 
Join Date: May 2005
Posts: 1
nefiga is on a distinguished road
Question Help with creating surrounding tag

Hi, I'm trying to create the equivalent code in javascript:
<media><img src="whatever"/></media>

My code is currently like this:


oImage = main.CreateElement( 'IMG' ) ;

/* this then calls this function */

main.CreateElement = function( tag )
{
var loc = main.EditorDocument.createElement( tag );
return main.InsertElementAndGetIt(loc);
}

/* this function is called above */

main.InsertElementAndGetIt = function( e )
{
e.setAttribute( '__TempLabel', 1 ) ;
this.InsertElement( loc ) ;
var aEls = main.EditorDocument.getElementsByTagName( e.tagName ) ;
for ( var i = 0 ; i < aEls.length ; i++ )
{
if ( aEls[i].getAttribute( '__TempLabel' ) )
{
aEls[i].removeAttribute( '__TempLabel' ) ;
return aEls[i] ;
}
}


This creates my <img> tag and I know how to set those specific <img> attributes from there, but I am confused about how to add the surrounding <media> tag. I've returned the location of the tag to oImage as stated in the first line of the code, but I don't know where to go from there. Any help?
Thanks
Ben
nefiga is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"fo:flow must contain block-level children" doesnt specify which tag gompol Java 2 03-08-2005 10:14 AM
Creating Jars freesoft_2000 Java 4 12-09-2004 04:45 AM
Creating Labels in VB patelk MS Technologies ( ASP, VB, C#, .NET ) 0 10-26-2004 10:06 AM
creating an array of an object on the freestore in c++ ?? sde Standard C, C++ 7 08-04-2002 01:39 PM


All times are GMT -8. The time now is 01:54 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting