In the code below I would like the focus to be set to the iFrame.
The intent is when a radio button is clicked, the contents of the iFrame would change. If the contents are longer than the display area, I want to be able to scroll down without moving the mouse to the iFrame scroll. I thought I needed to set the focus to the iFrame area.
I’ve tried some code (commented out) that doesn’t work.
Anyone have an idea how I could accomplish this?
[code=php]
<html>
<head>
<title>Clinic Minutes</title>
<script type=”text/javascript”>
var MinuteList = new Array();
MinuteList[0] = ”;
MinuteList[1] = ‘Minute001.html’;
MinuteList[2] = ‘Minute002.html’;
MinuteList[3] = ‘Minute003.html’;
// Change above array elements to valid files
function ShowMinute(item) {
document.getElementById(‘pickContent’).src = MinuteList[item];
// these attempts don’t work:
// document.getElementById(‘pickContent’).focus();
// parent.frames[‘pickContent’].document.forms[‘anyName’].pickContent.focus();
}
</script>
</head>
<body>
<center>
<h1> Clinic Minutes</a> </h1>
<form name=”anyName”>
<input type=”radio” name=’pick’ onClick=”ShowMinute(1)”> 6/7/2007
<input type=”radio” name=’pick’ onClick=”ShowMinute(2)”> 7/13/2007
<input type=”radio” name=’pick’ onClick=”ShowMinute(3)”> 7/20/2007
</form>
<p />
<iframe id=”pickContent” src=”” height=”300″ width=”600″ /></iframe>
</body>
</html>