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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

declare a variable outside of script and use it inside the js file 1

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
How can i define a variable outside of my js file and then use it inside my page? Is that possible?


Code:
<head>
<script type="text/javascript">
var MyVariable="Hello World!";
</script>
<script type="text/javascript" src="ajax.js"></script>

</head>

Jason

[red]Army[/red] : [white]Combat Engineer[/white] : [blue]21B[/blue]

 
Okay thanks Billy, i tried it before and it didnt work... but i tried it now... and with your special programming touch it worked. Thanks for taking the time and effort to program that one out for me...

[noevil]

Jason

[red]Army[/red] : [white]Combat Engineer[/white] : [blue]21B[/blue]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top