473,231 Members | 1,606 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,231 software developers and data experts.

Change single number in embed attribute every time page visited

27
Hello,
first to say that I am a total beginner in Javascript but I know some programming (python in particular) and am able to understand methods/parameters and so on.

Here's my problem:
I am trying to set up a page that changes every time it's visited, but without using php(which i don't know either) because it's not active on the server. The thing that should change is a single number in one attribute of an <embed> tag inside an <object>. The attribute itself is a long string of attributes - settings for the flash that runs in this embed-tag. In general I would like to change the number according to a file storing the number of visits and increments it with each new visit. So I need to set the whole attribute (which is a string called 'list' in the code below) from outside - with a javascript.

What I am trying now is simply setting the attribute without any changing/files. It looks like this:

[HTML]<script type="text/javascript">
function lista()
{
var list = "url=search_files/foret.swf&amp;feuilles=2&amp;objectif=100000000&am p;texte=Keep the left mouse button pressed &lt;br&gt; and move to look around.&amp;zoomM=Zoom %2D&amp;zoomP=Zoom %2B";
document.embeds[0].setAttribute("flashvars", list);
}
</script>[/HTML]

and the whole <object> looks like this:

[HTML]<object id="Flash" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" height="377" width="481">
<embed src="search_files/loader.swf" quality="high" bgcolor="#B3F285" name="&lt;NAME&gt;" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="377" width="481"></object>[/HTML]

I execute the function onload but the flash doesn't seem to get the parameters and stops after it's initial animation contained in the loader.

Where am I making a mistake?
May 16 '08 #1
5 2146
acoder
16,027 Expert Mod 8TB
To change the number each time without using server-side code, you need to use cookies.

Changed the thread title to better describe the problem.
May 16 '08 #2
elbin
27
Thank you for changing the title, I'll write more specific next time. Now i understand the cookies, but I still don't know why the code I gave you doesn't work. It doesn't set the embed attribute. I suppose I should put it into the checkCookie function that executes onload, but why doesn't it work?
May 19 '08 #3
acoder
16,027 Expert Mod 8TB
It probably doesn't work because the string being passed needs to be URL-encoded. Have you got it working with cookies?
May 20 '08 #4
elbin
27
I tried it but it doesn't work. I put the setattribute statement in the case when the cookie does not exist.

When I said I understood cookies I didn't mean I was able to use them, I just understand what they do generally. What do you mean URL-encoded?
May 20 '08 #5
acoder
16,027 Expert Mod 8TB
Read this technote by Adobe.
May 20 '08 #6

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

Similar topics

14
by: NotGiven | last post by:
I am guessing I would hold a variable of when it's opened, then in the script that runs when the page is offloaded, I coudl calcualte it. How do you store a time variable? How do you calculate...
3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
11
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
9
by: Muffinman | last post by:
Hi, I have a webpage with two Iframe's. I want to be able to change the target of all links in one frame so it will point to the other frame and all this from the main page. Is this possible and...
19
by: felixnielsen | last post by:
Some might remember that i, not so long ago, started a treath or two about a weird 3d labyrinth. I now have a working code, that i want to share, hear comments, advice, ect., but first let me...
1
by: richardscheff | last post by:
Video selector works for IE but not other browsers. for not IE <object ID='Player' data="video/dodgeball.wmv" type="video/x-ms-wmv" width="320" height="280"> <param name="filename"...
2
by: dkl1 | last post by:
Hi, I have the following HTML code (for playing a WAV sound file): <OBJECT ID=vidCtrl_success CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A" STYLE="display:none" VIEWASTEXT> <PARAM...
2
dream party
by: dream party | last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.