Hi, I can't get this to work, but I'm trying to update the text into an iframe on the same page with a button, for a game I'm making, the battle messages when you attack. Please any help greatly appreciated.
here is the html file with the button and onClick
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style type="text/css">
body {
background-color: black;
color: gold;
}
</style>
</head>
<body>
<html>
<body>
<script type="text/javascript">
var my_var = "Hello World!"
function text2add(){
return '<font color=gold><strong>'+my_var+'</strong></font>';
}
</script>
<form>
<form><input type="button" value="change" onClick="text2add();"/></form>
Main page! Frame below.
<br><br>
<iframe src="iframe.html" ></iframe>
</body>
</html>
</body>
</html>
and here is the iframe page code]
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
document.write(parent.text2add());
</script>
This is my iframe
</body>
</html>