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

can you atleast throw the bits of your code!? What do u actually intend to do?

///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...

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>

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.