954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

JavasScipt in Head and Body

Hi, I am in a unusual situation and cannot get my JavaScript to work. I need to have all of my JavaScript in one external file that I link to in the header. However, some of the JavaScript in that external tag needs to appear in a certain place in my body. However, because it is being linked to in the header I cannot get it there.

Is there anyway to have an external JavaScript file contain some JS that appears in the header and some that appears in the body? I'm at a loss and any help would be greatly appreciated. Thank you.

turverey
Newbie Poster
4 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

You are losting precision.
Post your code to enable us to help you.
Probably, you are getting error in the link.

Andrey Luiz
Newbie Poster
11 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

Sorry for the lack of detail.

The code that needs to be in the body is this:

$("#flashcontent").flash(
			{
				"src": "flash/fonts.swf",
				"width": "1",
				"height": "1",
				"swliveconnect": "true",
				"id": "fontshelper",
				"name": "fontshelper"
			}
		);


And then there is a Which is needed for the function to work. Right now I am trying to make it so that it does not need this div and the JavaScript can stay in the header and still work.

turverey
Newbie Poster
4 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

try to put this in your script tag:

<script type="text/javascript">
$("#flashcontent").flash(
			{
				"src": "flash/fonts.swf",
				"width": "1",
				"height": "1",
				"swliveconnect": "true",
				"id": "fontshelper",
				"name": "fontshelper"
			}
		);
</script>


If don't work, try this:

<script type="text/javascript" src="location/of/scriptarchive.js" />


If don't work anyway, post the complete code
with the javascript and the HTML for analisys.

I'll try to run it, OK?

Enjoy. :)

Andrey Luiz
Newbie Poster
11 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

What will do your .swf file ??? You want to change font of the div ??? If i am right, you can use CSS and put your own .TTF file and will work. If not tell better what do you want to do with the .swf and put all the source :)

P0lT10n
Posting Whiz in Training
235 posts since Apr 2010
Reputation Points: 13
Solved Threads: 30
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: