thanks for your help! i moved on to the next bit of removing the elements. i have the following code:
Code:
<script language="JavaScript">
var iteration = 0;
function AddToIngList (form, iteration)
{
var it = iteration;
var Ingredient = form.ingredienttoadd.value;
form.ingredients_added.value += Ingredient + "\n";
var objHTML, objText, objinput, objLink;
objHTML = document.createElement('P');
objHTML.setAttribute('NAME', 'txtTest');
objHTML.setAttribute('ID', 'txtTest');
var strTest = form.ingredienttoadd.value;
objText = document.createTextNode(strTest);
var strOnClick = 'Test();';
objLink = document.createElement('A');
objLink.setAttribute('HREF', 'http://www.sitepoint.com');
objLink.setAttribute('onclick', strOnClick);
objLink.appendChild(document.createTextNode('Delete This'));
objinput = document.createElement
('INPUT');
objinput.setAttribute('TYPE', 'text');
objinput.setAttribute('NAME', 'input'+it);
form.appendChild(objHTML);
objHTML.appendChild(objText);
objHTML.appendChild(objinput);
objHTML.appendChild(objLink);
}
function Test
()
{
document.write('Wahey');
}
so ive now got the behaviour i want for the click of the link - it calls another function (at the moment a pointless one but ill write what i want it to do later!) only problem is, it also goes to sitepoint.com. is there a way i can make the link reload the page. i know you can do it in php. bear in that if i have 3 elements and i delete one using this method. when the page reloads i still want the other 2 elements to be there!
thanks!
Bookmarks