Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS] [HTML] Tworzenie Funkcji - Nie Działa
Max1992
post 28.09.2007, 13:36:40
Post #1





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 4.05.2007

Ostrzeżenie: (0%)
-----


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>


Ten post edytował Max1992 28.09.2007, 13:37:32
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
kossa
post 28.09.2007, 14:02:12
Post #2





Grupa: Zarejestrowani
Postów: 1 165
Pomógł: 9
Dołączył: 9.04.2002
Skąd: Toruń

Ostrzeżenie: (0%)
-----


Spróbuj tak:

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


Łukasz


--------------------
Go to the top of the page
+Quote Post
Max1992
post 28.09.2007, 14:09:41
Post #3





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 4.05.2007

Ostrzeżenie: (0%)
-----


niestety nie pomogło :/
Go to the top of the page
+Quote Post
tsharek
post 28.09.2007, 14:12:33
Post #4





Grupa: Zarejestrowani
Postów: 300
Pomógł: 1
Dołączył: 22.09.2003
Skąd: Czeladź

Ostrzeżenie: (0%)
-----


  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ń


--------------------
Go to the top of the page
+Quote Post
Max1992
post 28.09.2007, 14:19:31
Post #5





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 4.05.2007

Ostrzeżenie: (0%)
-----


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>


Ten post edytował Max1992 28.09.2007, 15:02:16
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 15:05