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.

Recommended Answers

All 4 Replies

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

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 <div id="flashcontent"></div> 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.

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. :)

Member Avatar for P0lT10n

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.