Contact Yart for a relaxed conversation
Your Name * Message *
Your Email *  
Your Phone   
Our Phone:        03 8685 8718 (within Australia)
61 3 8685 8718 (outside Australia)
Contact Yart

Melbourne Content Management and Flash developers

 

for designers, agencies and your website

Resources / jQuery / Dynamic HTML in Frames with JavaScript
Dynamic HTML in Frames with JavaScript

Here's the code to add an "a" that is in an "li" that will be positioned in an existing "ul" and the "ul" is in a parent frame:

function AddMenuLI(name, Id)
{

//this is how you get the document of the parent frame
var menu_document = window.parent.menu.document;

//create the a and give it some attributes
var href = menu_document.createElement("a");
href.setAttribute("href", "EditMasterPage.aspx?Id=" + Id);
href.setAttribute("target", "rhs");
href.appendChild(menu_document.createTextNode(name));

var li = menu_document.createElement("li");
li.setAttribute("ID", "EditMasterPage_" + Id);
li.appendChild(href);

//find the ul" and position a child in it
var EditMasterPage_New = menu_document.getElementById("_MasterPages");
EditMasterPage_New.appendChild(li);
}

The latest at Yart
Search: