Jump to content

Some Javascript


[dx]
 Share

Recommended Posts

What's wrong with this, and can it be done at this way?

<a href='java script: function_name($some_var);'>Something</a><script type="javascript"> function function_name($some_var) {   var r = confirm('Some Question?');  if (r == true) {	some command;  }}</script>

This won't work for me in any case.RegardsNote: javascript word in a href tag is one word for me, this is some bug with forum

Edited by Haris S
Link to comment
Share on other sites

Replace 'some command' with some actual code, the script crashes because it doesn't know what some command means. Also, why do you have parameters in your function? Also, don't use dollar signs($) for variables in your parameters... just say some_var. Also, when calling function_name in that link, some_var would have to be declared out side of the function or be a string.The forum just feels like splitting the phrase "javascript" up for some reason. No one is really sure why it does that.

Edited by CloneTrooper9494
Link to comment
Share on other sites

<a class='admin' href='java script: reset_stats($profil)'>Reset</a>

function reset_stats(profil) {	var r = confirm('Zelite li resetovat statistike za korisnika $profil?');		if (r == true) {		header("location: index.php?admin=reset&op=$profil");	}}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...