how could i call a javascript function through an url like>

http://localhost/?functionname.params

i get how to do a link but i need to know if it is possible through an url.
if it is not posible with just javascript, php scripts will do

thanks!

Well you could have the function name as the query key and the parameters as the query value IE., test.com/?doThis=param1,param2,param3 Then in PHP

foreach($_GET as $key=>value){
   $values = split(",",$value);
   $key($values[0],$values[1],$values[2]);
}

Obviously, that's just an example but that's the jist of it. Not to mention that it is a GIGANTIC security gap. Seriously, you could start a country and form a small army inside that thing

u can call like this:

<html>
<head>
 <script>
	function Hi()
	{
		alert('Hi');
	}
 </script>
</head>
<body>
	<a href="javascript:Hi()">Hi</a>
</body>
</html>

or
u paste following in url it will work

javascript:(alert('hi'))

Try that again with smileys turned off.

type in url-
javascript:(alert('hi'));

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.