Calling JS function from index.html


#1

Hi,

I have an index.html file which I use to open/navigate (back and next buttons) other html files ( ones made in Hype). I’m trying to figure out how to call JS functions in index.html from Hype.

In Hype I added a JS function to a Button Mouse Click -

function clickMe(hypeDocument, element, event){

testJS(); // this should call the testJS function from the index.html
}

then in the index.html page I have this
function testJS()
{
alert(‘test JS called’);
}

However this doesn’t work. How do I call JS function from the index.html from Hype ?

Thanks


(Mark Hunte) #2

It should work?.

In the index.html

<html>
  <head>
 
<script>
	 function testJS()
{
alert('test JS called'); 
}
</script>

 
</head>
  <body>
 

	 <div id="nav_hype_container" style="margin:auto;position:relative;width:600px;height:400px;overflow:hidden;">
		<script type="text/javascript" charset="utf-8" src="nav.hyperesources/nav_hype_generated_script.js?40186"></script>
	</div>

 
</body>
</html>

#3

Unfortunately its not working for me. Not sure what the problem is.

I have this in the index html

  <div id="container"> <object type="text/html" data="jscall.html"> </object> </div>

Originally this index.html was used with swf files but has been changed to just do html files. It works just fine.I can navigate through html files I set but can’t get JS code called from Hype to work.