Solved

Problem with javascript includes

Posted on 2008-06-11
2
1,728 Views
Last Modified: 2008-06-19
I have an issue with javascript includes that constantly gets me.

Whenever I include some javascript, then add another block of javascript code, it seems to 'forget' the first block that I have included.

The error reported is 'SWFObject is undefined'

I'm missing something obvious, but could somebody tell me what...

Thanks in advance.
<title>Test Site</title>
	
	<script type="text/javascript" src="swfobject.js"></script>
	
	<script type="text/javascript">
	function loaded()
	{
		var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
		so.write("flashcontent");
	}
	</script>
	
</head>
<body onload="loaded();">
 
	<div id="flashcontent">

Open in new window

0
Comment
Question by:jerute
2 Comments
 
LVL 9

Expert Comment

by:zemond
ID: 21758280
are u saying that

      function loaded()
      {
            var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
            so.write("flashcontent");
      }
      </script>

is causing


<script type="text/javascript" src="swfobject.js"></script>

to fail?
0
 

Accepted Solution

by:
jerute earned 0 total points
ID: 21758557
No, I'vve just solved that problem which was of my own making. I had a window.onload call in the first javascript block which was being over-ridden by the body onload call to the second block. DUH.

As for the swfobject is undefined, I've just re-written the code from bottom up and it is now working, so I still don't know where I went wrong.

Sorry for wasting your time, and thx.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question