Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference variable in function? 1

Status
Not open for further replies.

customgt

IS-IT--Management
Jan 4, 2006
122
US
Function playmovie() {
n = 1;
javascript:play_n();
return;
}

The function starts and sets n = 1.
I want it to execute the next line, javascript:play_1();

How do I do that? Ive tried everything I know of...
 
How do I do that? Ive tried everything I know of...

Well, first off you can get rid of the [!]javascript:[/!] as it is not needed. Secondly, javascript is a case sensitive language and function declarations need to be declared with a lower-case "f"

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
Hi

Ugly solution :
Code:
[red]f[/red]unction playmovie()
{
  n = 1;
  [red]eval('[/red]play_[red]'+[/red]n[red]+'[/red]()[red]')[/red];
  return;
}
Nicer solution possible only if you post more detail.

Feherke.
 
ahh... play_1 - guess I should have read the whole question [smile]

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
>javascript:play_n();
[tt]eval("play_"+n+"()");[/tt]
 
so, here's a nicer solution w/o more detail [wink]
Code:
function playmovie() {
   n = 1;
   var a = window["play_" + n];
   a();
   return;
}

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson
 
thank you guys, that works!

yea i dont know why i typed a capital 'F' in this thread.

thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top