Toon posts:

[javascript] url dubbele variabele

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hallo,

Ik heb het volgende javascriptje. Mijn vraag is hoe ik een tweede php variabele aan de url kan toevoegen:

aanroep in php
PHP:
1
[img]"../CSS/gfx/questionmark.jpg"[/img]');" style="cursor: hand" border=NO title="Help">


de functie in javascript
JavaScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
<script language="javascript1.2">
<!--
function openhelpwindow(url,helpID)
    {
    b=500
    h=400
    x=300
    y=10
    url=('help.php?helpID='+helpID)
    window.open(url, '', "location=no,width="+b+",scrollbars=yes,height="+h+",toolbar=0,status=0,resizeable=0,location=0,directories=0,left="+x+",top="+y)
    }
//-->
</script>


Dus dan wordt mijn code in php:
PHP:
1
[img]"../CSS/gfx/questionmark.jpg"[/img]','<?echo$var2;?>');" style="cursor: hand" border=NO title="Help">


en in de functie:
JavaScript:
1
2
3
4
5
6
7
8
9
10
<script language="javascript1.2">
<!--
function openhelpwindow(url,var1,var2)
    {
    b=500
    h=400
    x=300
    y=10
    url=('help.php?helpID='+var1....... en dan????
</script>



Iemand een oplossing? Alvast bedankt

  • bigbeng
  • Registratie: Augustus 2000
  • Laatst online: 26-11-2021
Dit hoort eigenlijk in WG thuis.

Maar goed, het querystring deel van een URL
bv: http://blablabla.bla/x.php?var1=xxx&var2=yyy
staat zoals je ziet met een vraagteken achter aan de URL.
Binnen de querystring scheid je variabelen dmv een ampersand ('&').

  • Markieman
  • Registratie: December 2001
  • Laatst online: 15-05 12:16
zoiets:

code:
1
2
3
4
5
6
7
8
9
10
<script type="text/javascript">
<!--
function openhelpwindow(url,var1,var2)
    {
    b=500
    h=400
    x=300
    y=10
    url=('help.php?helpID='+var1+'&helpID2='+var2)
</script>

You do not fear them? - The Wraith? Naah. Now *clowns*, that's another story.


  • whoami
  • Registratie: December 2000
  • Laatst online: 23:32
javascript hoort in w&g thuis, zie ook de forumbeschrijvingen op de forumindex.

(Ik zie trouwens dat ik je er al eens op gewezen heb dat html, javascript, etc... niet in p&w thuishoort)

[ Voor 41% gewijzigd door whoami op 16-04-2004 13:10 ]

https://fgheysels.github.io/


  • crisp
  • Registratie: Februari 2000
  • Laatst online: 00:45

crisp

Devver

Pixelated

over niet thuishoren gesproken: "javascript:" in een eventhandler hoort daar ook niet thuis, en die verberg-script-voor-antieke-browser-dingetjes mag je tegenwoordig ook wel weglaten ;)

Intentionally left blank


Verwijderd

Topicstarter
Dank je wel!
Pagina: 1