mbrodersen
08-09-2006, 05:15 PM
I am new to JavaScript and wanted to know if there is a way to assign a variable a certian value and then include that variable within a <script src="..."> link reference.
Here is an example of what I am trying to do:
The following script takes a name of a city and truncates it to 5 characters.
<script type="text/javascript">
var actualcity = 'the name of a city';
var trunccity = (actualcity.substring(0,5));
onload = function(){
}
</script>
Now... I would like to take the variable trunccity and include it within a script src tag. The purpose is to get a local city feed from some weather site:
<script src='http://weatherurl/ [HERE IS WHERE I WOULD INSERT THE TRUNCCITY VARIABLE ] ?/111111'></script>
Any help would be greatly appreciated!
Here is an example of what I am trying to do:
The following script takes a name of a city and truncates it to 5 characters.
<script type="text/javascript">
var actualcity = 'the name of a city';
var trunccity = (actualcity.substring(0,5));
onload = function(){
}
</script>
Now... I would like to take the variable trunccity and include it within a script src tag. The purpose is to get a local city feed from some weather site:
<script src='http://weatherurl/ [HERE IS WHERE I WOULD INSERT THE TRUNCCITY VARIABLE ] ?/111111'></script>
Any help would be greatly appreciated!