| View previous topic :: View next topic |
| Author |
Message |
ArvindKamath
Joined: 06 May 2008 Posts: 3
|
Posted: Tue May 06, 2008 9:17 am Post subject: Using global Variables in HTML |
|
|
Hi ,
I have a query say that there are 10 different HTML pages and have a common message to be displayed for ex Copright XYZ.com i wanted to make such that i can place this in a common file and use the variables in the HTML pages if its possible please let me know waiting for reply
Regards ,
Arvind  |
|
| Back to top |
|
 |
|
|
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 627 Location: Cebu City Philippines
|
Posted: Tue May 06, 2008 10:07 am Post subject: Re: Using global Variables in HTML |
|
|
Possible on both client-side (Javascript) or Server-side (PHP or ASP)
...Decide on which of the two you'll use and we'll be glad to help you out  |
|
| Back to top |
|
 |
ArvindKamath
Joined: 06 May 2008 Posts: 3
|
Posted: Tue May 06, 2008 10:41 am Post subject: Re: Using global Variables in HTML |
|
|
hey
thanks for the reply it would be using javascript please let me how to do it with example it would be great
Regards,
Arvind |
|
| Back to top |
|
 |
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 627 Location: Cebu City Philippines
|
Posted: Tue May 06, 2008 11:07 am Post subject: Re: Using global Variables in HTML |
|
|
This shall be the steps:
1.) Know your division element's id. For instance, if you want your "global variable" to show in a particular div, then just take note of that elements id. Example:
<div id="footer"></div>
2.) Note the highlighted, then in your JS, you'll have:
| Code: |
<script type="text/javascript">
window.onload=function()
{
var myvar = 'Copyright 2008 by Raymond Angana and Company and all of which....';
document.getElementById('footer').innerHTML=myvar;
}
</script>
|
3.) Replace the contents of myvar variable.
4.) Then, have some beer  |
|
| Back to top |
|
 |
ArvindKamath
Joined: 06 May 2008 Posts: 3
|
Posted: Tue May 06, 2008 11:18 am Post subject: Re: Using global Variables in HTML |
|
|
Hey Buddy,
Thanks a lot Yippe!!! it worked
 |
|
| Back to top |
|
 |
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 627 Location: Cebu City Philippines
|
Posted: Tue May 06, 2008 11:26 am Post subject: Re: Using global Variables in HTML |
|
|
You're welcome. Glad I could help  |
|
| Back to top |
|
 |
|