faqts : Computers : Programming : Languages : JavaScript : Frames

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 8 people (100%) answered Yes
Recently 5 of 5 people (100%) answered Yes

Entry

<script></script> block is executed only if it is placed in the head section of the frameset page.How to get it to execute if placed somewhere else??

Nov 21st, 2000 16:30
Narayanan Sankaranarayanan, anupriya ramraj, Reply: block is executed only if it is placed in the head section of the frameset page.How to get it to execute if placed somewhere else??


Hi,
This is Ryan Norman ( Narayanan Sankaranarayanan ).
I don't think that the script tag can be given after the frameset tag.
But I have a workaround for that. I tested that. It works fine.
I have pasted the sample code for that. Hope this helps.
test3Main.htm
=============
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>
			Workaround to use Script tag using Frameset.
		</title>
	</head>
	<script language="JavaScript">
		document.writeln( '<frameset cols="50%, *">' );
		document.writeln( '		<frame 
src="test3Frame1.htm">' );
		document.writeln( '		<frame 
src="test3Frame2.htm">' );
		document.writeln( '</frameset>' );
		alert( top.frames[ 0 ].document.forms.length );
		top.frames[ 0 ].document.forms[ 0 ].txtName.value 
= "Ryan Norman ( Narayanan Sankaranarayanan )";
	</script>
</html>
test3Frame1.htm
===============
<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
	<head>
		<title>
			Frame 1
		</title>
	</head>
	<body>
	<form name="frmMain" action="" method="post">
		Enter Your Name :
		<input type="text" name="txtName" value="My Love Radhu" 
size="20" maxlength="20">
	</form>
	</body>
</html>
test3Frame2.htm
===============
<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
	<head>
		<title>
			Frame 2
		</title>
	</head>
	<body>
		Frame 2
	</body>
</html>