0

hello everybody,
In my project, i have used frames in one web page.and whatever javascript i have written in that page is not executed...why...?

Thank you

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by thillai
0

///this s my file clerk.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Clerk </title>
</head>

<frameset cols="120,*">

<frame src="navigate.html">
<frame src="main.html" name="main">


</frameset>

</html>

navigate.html has 2 frame in it..
so i want to execute javascript in first frame of navigate.html..but its not executed...i tried many times.........i need to validate data of navigate.html 's first frame which shows register form...

0

It would be nice if you can post the actual code! But i wil just perform a basic example on how to execute javascript within framed pages!


mainFrame

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"  "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Clerk</title>
</head>
<frameset cols="120,*">
<frame src="navigate.html">
<frame src="main.html" name="main">
<noframe>
<body>
Attention! This site must be accessed with a browser that supports frames.<br />
Thank you!
</body>
</noframe>
</frameset>
</html>

navigate.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
<title>Navigation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!-- 
body { margin: 0 auto; padding: 0; }
h1 { text-align: center; font-weight: bold; }
-->
</style>
</head>
<body bgcolor="silver">
<h1>Top Frame</h1>
</body>
</html>

main.html
In this section i will execute some script to get the last date the page was updated!

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
<title>Body</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
body { margin: 6px; padding: 4px; }
span { margin-bottom: 20px; }
-->
</style>
<script type="text/javascript">
<!-- BEGIN HIDING
window.onload = function() 
{ var lastUpdated = document.getElementById('frame1');
  var thisDate = new Date( lastUpdated.contentWindow.document.lastModified );
  var month = thisDate.getMonth() +1;
  var date = thisDate.getDate();
  var year = thisDate.getFullYear();
  updated = '<nobr>Last updated: ' + month + '/' + date + '/' + year + '</nobr>'; 
document.getElementById('s1').innerHTML = updated;
}
// DONE HIDING-->
</script>
</head>
<body bgcolor="grey">
<p>
<span id="s1"></span>
</p>
<br />
<br />
<div>
<iframe id="frame1" src="samp.html"  style="border: none;"></iframe>
</div>
<!-- Hope this would help you! Enjoy... -->
</body>
</html>
0

ya..problem is solved..because of different versions of browser, script is not executed..
thank u essential....
i tried in diff browser..its working

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.