Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JS] [HTML] Tworzenie Funkcji - Nie Działa
Forum PHP.pl > Forum > Przedszkole
Max1992
Mam Funkcję:

Kod
var content=new Array()
content[0]='cos'
content[1]='cos2'
content[2]='cos3'
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
appear()
setTimeout("window.onresize=regenerate",450)
}
}

function changetext(co, whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("co"):document.all.co
cross_el.innerHTML='<font color="black">'+whichcontent+'</span>'
}
else if (document.layers){
document.d1.document.d2.document.write('<font color="black">'+whichcontent+'</span>')
document.d1.document.d2.document.close()
}
}
function appear(){
document.d1.visibility='show'
}

window.onload=regenerate2


I nie wiem czemu nie chce działać :/

a oto przykład wywołania:

Kod
<table width="449" border="1" bordercolor="#000000" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="50%">
<div id="scriptmenu" style="line-height:20px">
<P align="center" onMouseover="changetext(descriptions1, content[0]);">cosik tam</P>
<P align="center" onMouseover="changetext(descriptions1, content[1]);">cosik tam2</P>
<P align="center" onMouseover="changetext(descriptions1, content[2]);">cosik tam3</P>
</div>
</td>
    <td width="50%" valign="middle" align="center">


<div id="descriptions1"> </div>
kossa
Spróbuj tak:

  1. onMouseover="changetext('descriptions1', 'content[0]')"


Łukasz
Max1992
niestety nie pomogło :/
tsharek
  1. document.d1.visibility='show'

http://www.w3schools.com/css/pr_class_visibility.asp
  1. document.d1.visibility='visible';


ps: nawet w javascripcie dobrym zwyczajem jest używanie średników na końcu poleceń
Max1992
niestety też nic :/

ale mam też coś takiego

Kod
function changetext(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML='<font color="black">'+whichcontent+'</span>'
}
else if (document.layers){
document.d1.document.d2.document.write('<font color="black">'+whichcontent+'</span>')
document.d1.document.d2.document.close()
}
}


i to działa tylko że chciał bym aby wyświetlało w więcej niż jednym oknie smile.gif powyższe działa ale powtarzanie to ciagle jest jednak trochę xłym pomysłem, dużo miejsca itp.

description oznacza miejsce pokazania treści

Edit:

To jest orginalny kod:

Kod
<script>
<!--

var content=new Array()
content[0]='<p align=center>To jest przykładowy tekst 1</p>'
content[1]='<p align=center>To jest przykładowy tekst 2</p>'
content[2]='<p align=center>To jest przykładowy tekst 3</p>'
content[3]='<p align=center>To jest przykładowy tekst 4</p>'
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
appear()
setTimeout("window.onresize=regenerate",450)
}
}

function changetext(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML='<font color="black">'+whichcontent+'</span>'
}
else if (document.layers){
document.d1.document.d2.document.write('<font color="black">'+whichcontent+'</span>')
document.d1.document.d2.document.close()
}

}

function appear(){
document.d1.visibility='show'
}

window.onload=regenerate2
</script>

<title>Java</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<META NAME="konwerter" CONTENT="Ogonki97 1.3">
<link rel="stylesheet" href="../style.css" type="text/css">
</head>

<body bgcolor="#408cc0" text="#000000">

<table width="449" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td width="120" height="20" valign="top">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="zama">
        <tr>
          <td width="120" height="20" background="../grafa/menu.gif" valign="middle" align="center">Java</td>
        </tr>
      </table>
    </td>
    <td width="329"></td>
  </tr>
  <tr>
    <td height="2"></td>
    <td></td>
  </tr>
  <tr>
    <td height="349" colspan="2" valign="top">
      <table width="100%" border="0" cellpadding="5" cellspacing="0" class="zama">
        <tr>
          <td width="449" height="349" background="../grafa/tlo.gif" valign="top" align="center">
<table border="1" width="100%" bordercolor="#000000" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%">
<div id="scriptmenu" style="line-height:20px">
<P align="center"><a href="jakis link" onMouseover="changetext(content[0])">To jest przykładowy link 1</a></P>
<P align="center"><a href="jakis link" onMouseover="changetext(content[1])">To jest przykładowy link 2</a></P>
<P align="center"><a href="jakis link" onMouseover="changetext(content[2])">To jest przykładowy link 3</a></P>
<P align="center"><a href="jakis link" onMouseover="changetext(content[3])">To jest przykładowy link 4</a></P>
</div>
</td>
    <td width="50%" valign="middle" align="center">

<ilayer id="d1" width="200" height="200" visibility="hide">
<layer id="d2" width="200" height="200">
<div id="descriptions"> </div>
</layer>
</ilayer>
    </td>
  </tr>
</table>
</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.