Comments are available to members only. Sign up or Log in to view these comments.
Main Topics
Browse All TopicsDear all experts!
This is a Firefox related question.
Can someone show me how to dynamically add a keydown event to the iframe in the code below, so that the updateTa() function is executed and the text area updated with the HTML code of the iframe?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html
<head>
<title>My DHTML Editor</title>
<style type="text/css">
#DHTMLEditor,#DHTMLsrc{
width:500px;
height:500px;
}
#DHTMLsrc{
}
#DHTMLEditor{
border:1px solid #000000;
margin:0px;
}
</style>
<script type="text/javascript">
var bodyRef;
var taRef;
var editorRef;
function updateTa(){ // THIS FUNCTION IS NEVER EXECUTED ON FIREFOX - WHY?
taRef.value=bodyRef.innerH
alert('hello');
}
function initEvents(){
bodyRef.onkeyup=updateTa; // THIS DOESN'T WORK ON FIREFOX
}
function editorInit(){
taRef = document.getElementById('D
if(!document.all){
document.getElementById("D
bodyRef= document.getElementById("D
editorRef= document.getElementById("D
bodyRef.innerHTML = document.getElementById('D
}else{
bodyRef = document.getElementById("D
editorRef = document.getElementById("D
bodyRef.innerHTML = document.getElementById('D
}
initEvents();
}
window.onload = editorInit;
</script>
</head>
<body>
<iframe frameborder="0" marginheight="0" marginwidth="0" id="DHTMLEditor"></iframe>
<textarea id="DHTMLsrc">Init <b>Content</b> is comming here</textarea>
</body>
</html>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: archrajanPosted on 2005-04-09 at 11:17:53ID: 13744427
Comments are available to members only. Sign up or Log in to view these comments.