IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

HTML Discussion :

<object> compatible XHTML


Sujet :

HTML

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Octobre 2011
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2011
    Messages : 25
    Par défaut <object> compatible XHTML
    Bonsoir à tous,

    J'ai utilisé CU3ER pour une de mes animations flash mais je n'arrive pas à valider son code en XHTML.

    Quelqu'un pourrait m'aider svp?

    Voici le code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <script type="text/javascript">
      function writeFlash(title, w, h) {
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.0.0" width="' + w + '" height="' + h + '" ID="sf" VIEWASTEXT>')
        document.write('  <param name="movie" value="' + title + '.swf" />')
        document.write('  <param name="quality" value="high" />')
        document.write('  <param name="wmode" value="window" />')
        document.write('  <param name="allowScriptAccess" value="always" />')
        document.write('  <param name="allowFullScreen" value="true" />')
        document.write('  <embed src="' + title + '.swf" quality="high" name="sf" allowScriptAccess="always" allowFullScreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>')
        document.write('</object>')
      }
    </script>

  2. #2
    Membre Expert
    Avatar de Eric2a
    Homme Profil pro
    Technicien
    Inscrit en
    Septembre 2005
    Messages
    1 225
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Corse (Corse)

    Informations professionnelles :
    Activité : Technicien

    Informations forums :
    Inscription : Septembre 2005
    Messages : 1 225
    Par défaut
    Salut,

    Essaie comme ceci...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    function writeFlash(title,w,h,elt){
    	var	s,
    		id=typeof elt!=='undefined'?document.getElementById(elt):null;
     
    	s ='<object type="application/x-shockwave-flash" data="' + title + '.swf" width="' + w + '" height="' + h + '" id="sf">';
    	s+=' <param name="movie" value="' + title + '.swf" \/>';
    	s+=' <param name="quality" value="high" \/>';
    	s+=' <param name="wmode" value="window" \/>';
    	s+=' <param name="allowScriptAccess" value="always" \/>';
    	s+=' <param name="allowFullScreen" value="true" \/>';
    	s+='<\/object>';
     
    	if(id)
    		id.innerHTML=s;
    	else
    		document.write(s);
    }
    Si l'élement XHTML destiné à contenir l'objet est créé avant appel à la fonction, il est préferable de lui donner un id et de passer ce dernier en paramètre à la fonction. Histoire d'éviter document.write().

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Octobre 2011
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2011
    Messages : 25
    Par défaut
    Salut,

    Je te remercie énormément!

    Mais il me reste encore une erreur que voici:


    -----------------


    Line 88, Column 120: document type does not allow element "object" here

    …flash" data="' + title + '.swf" width="' + w + '" height="' + h + '" id="sf">';



    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

    -----------------
    Saurais-tu d'où ça provient stp?

  4. #4
    Membre Expert
    Avatar de Eric2a
    Homme Profil pro
    Technicien
    Inscrit en
    Septembre 2005
    Messages
    1 225
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Corse (Corse)

    Informations professionnelles :
    Activité : Technicien

    Informations forums :
    Inscription : Septembre 2005
    Messages : 1 225
    Par défaut
    En placant le code Javascript entre //<![CDATA[ et //]]>, l'analyseur syntaxique ne tentera plus d'interpreter les chevrons.

    Code xhtml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <script type="text/javascript">//<![CDATA[
     
            function writeFlash(title,w,h,elt){
                    // ...
            }
    //]]>
    </script>

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Octobre 2011
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Octobre 2011
    Messages : 25
    Par défaut
    Superrrr


    Merci infiniment

    Ca fonctionne nickel


    Merci beaucoup beaucoup!!!!!!!!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. EJB List <object[]> +JSF(page xhtml)
    Par sino100100 dans le forum JSF
    Réponses: 4
    Dernier message: 24/08/2009, 13h51
  2. Réponses: 1
    Dernier message: 16/07/2008, 14h37
  3. [XHTML] Balise OBJECT pour lire une vidéo...
    Par zoidy dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 02/06/2006, 10h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo