473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Importing javascript to html file

119 100+
Hi All,

I have html page, in that i have some flash header. In that flash header i have sound on/off function. i implemented this in my html page. but i need some modification in this. now it works fine. if i switch off the flash sound sound gets switch off. But if i again refresh page or navigate to another page falsh sound gets switch on automatically.

But i dont want to switch on sound automatically.

Can any one give me idea how to overcome this problem.

i have given my script and html script below

Expand|Select|Wrap|Line Numbers
  1. <div id="container">        
  2.         <div id="logoflash">
  3.                 </div>            
  4.         <div id="load">
  5.                 </div>        
  6.                 <div class="contentbg">
  7. ---------------------------------------
  8. --------------------------
  9. --------------Some code---------------------
  10. ----------------------------------------
  11.  
  12. </container>
  13.  
  14.  
  15. <script type="text/javascript">
  16. var flashlogo = new SWFObject("images/Flash_Logo_v1.swf", "slideshow", "394", "267", "6", "#000");
  17.     flashlogo.addParam("wmode", "transparent", "high");
  18.     flashlogo.write("logoflash");
  19.  
  20.     var flashpic = new SWFObject("images/Flash_Pics_v3.swf", "slideshow2", "600", "300", "6", "#000");
  21.     flashpic.addParam("wmode", "transparent", "high");
  22.     flashpic.write("pictflash");
  23.  
  24.     var sound = new SWFObject("images/ad1-sound-on.swf", "slideshow1", "27", "20", "6", "#000");
  25.     sound.addParam("wmode", "transparent", "high");
  26.     sound.write("load");
  27. </script>
  28.  
This same format will repeat for all the pages which loading.

Thanks in advance,

Regards,
Magesh
Jul 15 '09 #1
5 2285
gits
5,390 Expert Mod 4TB
in this case you could use a cookie to make the users choice persistent, or pass it everytime through an url-param, another option is to use a serverside storage (session or whatever) ... when the switch-off action is triggered do a request (probably the best is an ajax-call to avoid page-reload) and store the choosen option. when you refresh the page you will loose every runtime-made settings unless you store them somewhere before.

kind regards
Jul 15 '09 #2
phpmagesh
119 100+
@gits
Thanks Gits,

But i m not using any Server side scripting or client side scripting for my application, even i dont have cookie or session. Is there any other way to control this flash sound other than this...

Regards,
Jul 15 '09 #3
acoder
16,027 Expert Mod 8TB
You are using client-side scripting (the JavaScript code which interfaces with Flash). The web is stateless by default. As gits suggested, use client-side cookies to store that the sound should be off by default. When the page loads, check for the cookie and if set, read it and set the sound accordingly.

Just a question though: do you want sound to be off for everyone by default or just for the user that decides to switch it off?
Jul 15 '09 #4
phpmagesh
119 100+
@acoder
By default the sound should be ON. if user wish he supposed to switch off the music. but till he switch ON that music. it should be in OFF state..

I think i meet your question.

Kind Regards,
Jul 16 '09 #5
acoder
16,027 Expert Mod 8TB
So set a cookie when the user turns the sound off. On page load, check if this cookie is set. If it is, set the sound off. If not, you don't need to do anything as the sound is on by default.

To set, read and delete cookies, see the following links:
http://www.quirksmode.org/js/cookies.html
http://www.w3schools.com/js/js_cookies.asp
Jul 16 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: jean-marc | last post by:
As an application programmer, I'm not well versed in the material aspects of computing (memory, cpu, bus and all). My understanding of imports in Python is such: the __main__ program is the center...
1
by: Emil Karlen | last post by:
Using the import-tag, a template appearing in the imported file, can be extended in the importing file. I am extending a template this way and in the main-file, inside the template use...
6
by: Kamilche | last post by:
I have a large project that is getting complex, and I would like to print the docstrings without importing the modules. The only Python utility I could find references is apparently defunct and...
11
by: Grim Reaper | last post by:
I am importing a .csv file into Access that has 37 fields. My problem is that sometimes the last field only has data at the end of the column (it looks like when you import a file into Access, for...
29
by: Natan | last post by:
When you create and aspx page, this is generated by default: using System; using System.Collections; using System.Collections.Specialized; using System.Configuration; using System.Text; using...
6
by: rpjanaka | last post by:
Hi all, Instead of writing javascript functions on the html page it self, we could write those in separate “.js” file and import it as follow. <script src="fileName.js" ></script> But when...
1
by: Phil | last post by:
I want to add a button to a form to import a text delimited file. The File is delimited by "^" and so I have created a specification file by manually impoting the text file, using the advanced...
5
by: dbsmilr | last post by:
This is what I want to do: <html> <xml id="myXml"> <book title="book1" /> <book title="book2" /> </xml> <div id="out"><!-- I would output the xml formatted nicely for the user in this...
6
by: passionateforjava | last post by:
Hi All, I am using struts application wherein I need to import file for some purpose.I have used input type="file" for the same which goes like: <input type="file" id="uploadFile" name="uploadFile"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.