Send to a Friend

netxm's avatar

Javascript help, please?

Asked by netxm (288points) February 17th, 2009

here I need one thing – var phrase has to represent phrasethat was clicked, onmousedown created in html

function eventSource(e) {
var IE = document.attachEvent ? true:false;
var DOM = document.addEventListener ? true: false;
if (IE) return event.srcElement;
else if (DOM) return e.currentTarget;

}
function setUpTranslation() {
var phrases = document.getElementsByTagName(“p”);
for (var i=0; i<phrases.length; i++){
phrases[i].childNodes[1].innerHTML=french[i];
}

}

function swapFE(e){

var phrase = eventSource(e);

var phrasenum=parseInt(phrase.previousSibling());
phrase=english[phrasenum-1];
phrase[i].style.color=rgb(155,102,102);
}

function swapEF(e){
phrase = eventSource(e);
phrase.innerHTML=french[phrasenum-1];
phrase.style.fontStyle=italic;
phrase.style.fontcolor=black;
}

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.