Condividi:        

tag iFrame

Problemi di HTML? Di PHP, ASP, .NET, JSP, Perl, SQL, JavaScript, Visual Basic..?
Vuoi realizzare programmi in C, C++, Java, Ruby o Smalltalk, e non sai da che parte cominciare?
Entra qui e troverai le risposte!

Moderatori: Anthony47, Triumph Of Steel, archimede

tag iFrame

Postdi chickym0nkey » 04/05/06 09:16

ragazzi,
vi espongo il mio problema...
mettiamo caso che in home page abbia una cella iframe... come faccio a fare in modo che se clicco su un link(che si trova sempre in home page) mi si apre in quella cella un video??
spero di essermi spiegato bene...
Grazie a tutti!
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma

Sponsor
 

Postdi archimede » 04/05/06 10:02

Forse puoi usare questo come base di partenza (funziona in IE, non so altri browsers):
Codice: Seleziona tutto
<html>
<head>
<script language="javascript">
<!--
function Show(t) {
   var testFrame = document.getElementById("myFrame");
   var val;
   var doc = testFrame.contentDocument;

   val = "Hai scritto: "+t;

   if (doc == undefined || doc == null)
      doc = testFrame.contentWindow.document;
   doc.open();
   doc.write(val);
   doc.close();

   document.all.myFrame.style.visibility="visible";
}
function Button1_onclick(t) {
   Show(t);
}
//-->
</script>
</head>
<body>
<iframe id="myFrame" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" width="100" scrolling=yes height="100" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 999; LEFT: 20px; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 100px; visibility:hidden;"></iframe>
<form id="form1">
  <input type="text" name="testo">
  <input type="button" value="Show" id="Button1" name="Button1" onclick="return Button1_onclick(form1.testo.value)">
</form>
</body>
</html>
HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi chickym0nkey » 04/05/06 11:34

scusa l'ignoranza :oops: ...mi spiegheresti le modifiche da apportare per consentire il caricamento di un video?
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma

Postdi Triumph Of Steel » 04/05/06 11:53

ma se come target del link al video, gli dai "_self" (che di solito è il default), non funziona?

Codice: Seleziona tutto
<a href="video.htm" target="_self">Video</a>


oppure dai un nome all'iframe, e come target usi lo stesso nome (non so se è giusto però...)
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00

Postdi chickym0nkey » 04/05/06 12:39

mmm...se gli do' il self non me lo fa aprire in un iframe... stessa cosa se gli do il target...
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma

Postdi archimede » 04/05/06 13:50

chickym0nkey ha scritto:scusa l'ignoranza :oops: ...mi spiegheresti le modifiche da apportare per consentire il caricamento di un video?
Dovrebbe (non ho provato, per cui non lo so) essere sufficiente mettere al posto di "Hai scritto: "+t; il codice HTML che serve per visualizzare il video. Ad esempio (se fosse un'immagine):
Codice: Seleziona tutto
val = "<img src='/images/logo.gif' border='0' width='170' height='60' alt='Immagine in un iFrame' title='Immagine in un iFrame'>";
HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi chickym0nkey » 04/05/06 14:54

per mettere 2 video invece di uno ho fatto cosi':
Codice: Seleziona tutto
<html>
<head>
<script language="javascript">
<!--
function Show(t) {
   var testFrame = document.getElementById("myFrame");
   var val;
   var doc = testFrame.contentDocument;

   val = "<img border='0' dynsrc='prova.avi' width='320' height='300' alt='Immagine in un iFrame' title='Immagine in un iFrame'>";

   if (doc == undefined || doc == null)
      doc = testFrame.contentWindow.document;
   doc.open();
   doc.write(val);
   doc.close();

   document.all.myFrame.style.visibility="visible";
}
function Button1_onclick(t) {
   Show(t);
}
//-->
</script>
<script language="javascript">
<!--
function Show(t) {
   var testFrame = document.getElementById("myFrame");
   var val;
   var doc = testFrame.contentDocument;

   val = "<img border='0' dynsrc='video.mpg' width='320' height='300' alt='Immagine in un iFrame2' title='Immagine in un iFrame2'>";

   if (doc == undefined || doc == null)
      doc = testFrame.contentWindow.document;
   doc.open();
   doc.write(val);
   doc.close();

   document.all.myFrame.style.visibility="visible";
}
function Button2_onclick(t) {
   Show(t);
}
//-->
</script>

</head>
<body>
<iframe id="myFrame" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" width="320" scrolling=no height="300" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 999; LEFT: 20px; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 100px; visibility:hidden;"></iframe>
<form id="form1">
  <input type="text" name="testo">
  <input type="button" value="Show" id="Button1" name="Button1" onclick="return Button1_onclick(form1.testo.value)">
   </form>
<form id="form2">
  <input type="text" name="testo">
  <input type="button" value="Show" id="Button2" name="Button2" onclick="return Button2_onclick(form2.testo.value)">
   </form>
</body>
</html>

pero' mi fa vedere solo il secondo video...cosa sbaglio??
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma

Postdi archimede » 04/05/06 16:04

Cioè vuoi far vedere due video contemporaneamente nello stesso iFrame? Allora in val devi mettere l'HTML per DUE video.

In ogni caso non puoi definire due funzioni JavaScript con lo stesso nome nella stessa pagina; semmai chiami due volte la stessa funzione (eventualmente passando dei parametri). Qui però non lo puoi fare perché la Show cambia il contenuto dell'iFrame ogni volta che viene invocata.

HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi chickym0nkey » 05/05/06 09:12

no ti spiego... quello che vorrei fare e' mettere 2 pulsanti in modo che qualndo clicco su uno si apre un video nell'iframe e quando clicco sull'altro se ne apre un altro, ma non insieme...
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma

Postdi archimede » 06/05/06 07:32

Codice NON testato:
Codice: Seleziona tutto
<html>
<head>
<script language="javascript">
<!--
function Show(t) {
   var testFrame = document.getElementById("myFrame");
   var val;
   var doc = testFrame.contentDocument;

   val = "<img border='0' dynsrc='"+t+"' width='320' height='300' alt='Video in un iFrame' title='Video in un iFrame'>";

   if (doc == undefined || doc == null)
      doc = testFrame.contentWindow.document;
   doc.open();
   doc.write(val);
   doc.close();

   document.all.myFrame.style.visibility="visible";
}
//-->
</script>
</head>
<body>
<iframe id="myFrame" frameborder="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" width="320" scrolling=no height="300" style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 999; LEFT: 20px; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 100px; visibility:hidden;"></iframe>
<input type="button" value="Video1" id="Video1" name="Video1" onclick="return Show('prova.avi')">
<input type="button" value="Video2" id="Video2" name="Video2" onclick="return Show('video.mpg')">
</body>
</html>
HTH.

Alessandro
archimede
Moderatore
 
Post: 2851
Iscritto il: 07/11/02 12:41
Località: Genova

Postdi chickym0nkey » 08/05/06 15:38

Grande!! funziona alla perfezione!
ti chiedo solo un ultimissimo favore... sarebbe possibile fa aprire il video con la barra di controllo di windows media player?? (play, stop, pause ecc...)
Ancora grazie!
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma

Postdi chickym0nkey » 10/05/06 12:53

c6 archimede?solo quell'ultima modifica poi ti giuro che lo kiudo io il topic eheh :D
chickym0nkey
Utente Senior
 
Post: 535
Iscritto il: 16/07/02 18:12
Località: roma


Torna a Programmazione


Topic correlati a "tag iFrame":

IFRAME
Autore: gexxy
Forum: Software Windows
Risposte: 1
[Iframes] Nirvana iframe pack
Autore: Sora88
Forum: Discussioni
Risposte: 4

Chi c’è in linea

Visitano il forum: Nessuno e 15 ospiti