Autor Beitrag
Darkpara
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Mi 03.10.07 14:22 
hm jo der titel sagt glaub scho alles :)

kleines beispiel:


ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
               function TreeView1JSChangeSelected($sender, $params)
               {
               ?>
               //Add your javascript code here

               var test = 5;

               <?php
               $test =  die test var vom javascript zuvor;
               ....
               ....
               ?>
               <?php
               }


hat wer ne lösung wie ich das machen kann?

Moderiert von user profile iconChristian S.: Code-Tags hinzugefügt
LeoLöwe
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 45

Win XP Home
BDS 2006, PHPCoder
BeitragVerfasst: Mi 03.10.07 14:30 
Die Variable als GET-Parameter an ein Script übergeben, wäre eine Lösung von vielen

Also im Javascript-Teil einfügen
var test = 5;
document.location = "script.php?test="+test;

Und im PHP-Script
echo $_GET['test'];

Müsste eigentlich so funtionieren. Du könntest auch eine Ajax-Anfrage an den Server senden, dann müsste man nicht die gesamte Seite neu laden sondern könnte die Daten im Hintergrund übertragen
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 03.10.07 15:19 
Direkt geht das nicht, weil JS erst im Browser ausgeführt wird, PHP bereits auf dem Server.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Darkpara Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Mi 03.10.07 16:05 
hm mit dem GET gings irgendwie nicht richtig, da jedoch das ziel dieser variable nur das öffnen der richtigen seite war hab ich nun den

document.location = "http://...."

befehl genutzt um direkt meine neue seite aufzurufe.

nur noch eine kleinigkeit kann man die neue seite auch in einem neuen fenster öffnen?
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Mi 03.10.07 17:15 
Ja, wie jetzt? Also als Link so: <a href="Ziel" target="_blank">Beschreibung</a>
Mit JavaScript weiß ich nicht, wie's geht. Könntest ja mal bei Selfhtml gucken. ;)
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mi 03.10.07 17:27 
Guck dir mal die Methode window.open an.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Darkpara Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Mi 03.10.07 17:40 
hat geklappt thx :)