Hi all,

I am trying to run a javascript function, RH_ShowHelp, that is stored in the file RoboHelp_CSH.js. The function itself should open a popup window containing our product's help system (written with Adobe RoboHelp) and the javascript file was supplied by Adobe as the standard call. I have managed to test the javascript in a straight HTML page which works, but I can't seem to be able to get this to work in PHP.

function callHelp( $helpURL )
{
	$language = "javascript";
	$src = "include/RoboHelp_CSH.js";
	echo "<script src=$src language=$language> RH_ShowHelp( 0, $helpURL, HH_HELP_CONTEXT, $currentId ) </script>";
}

Any ideas on where am I going wrong?

Thanks in advance,
darkagn

Recommended Answers

All 3 Replies

Hi.

You shouldn't load and execute code using the same <script> tag.
And all <script> blocks should be inside the <header> block, or at least all <script> blocks that are meant to load external code.

You could do this like so:

<html>
<head>
	<title>Test</title>
	<script src="test.js" type="text/javascript"></script>
</head>
<body>
<?php 
	echo '<script type="text/javascript">someFunction();</script>'; 
?>
</body>
</html>
commented: Solved my problem, thankyou! :) +3
commented: quick response!!!!!keep it up.... +2

Thanks Atli that is exactly what my problem is!

hi...
we've a problem including java script function in our PHP code,
we've a fuction called print_many_words(object name)which is wrritten in javascript, now we want to use this function in the shown echo statement

echo "<td><input type=\"hidden\" name=\"Word\" value=$String ><b>$String</b></td>";
here we want to include print_many_words(object name) with onFocusOut...

how to do this?? please reply soon
Thank you....

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.