Re: Dopey javascript question

by "Rossi Designs" <webmaster(at)rossidesigns.net>

 Date:  Wed, 17 May 2000 16:39:24 -0400
 To:  <hwg-languages(at)hwg.org>,
"Lara Fabans" <lara(at)flashcom.net>
 References:  0
  todo: View Thread, Original
Whenever I pass a variable from PHP to javascript I do it like this.

var siteVar="<?php echo $siteVar ?>";

Or if the variables are in the url you can do this.

<script language="javascript">
<!--
var q_str = location.search.substring(1);
var get_vars = q_str.split("&");
for (x=0;x<get_vars.length;x++) eval(get_vars[x]);
// -->
</script>

All your get variables should be javascript variables.

Rossi Designs
PO Box 1084
Holly Hill, FL 32125-1084
Phone : (904) 226-8979
URL : http://rossidesigns.net
----- Original Message -----
From: Lara Fabans <lara(at)flashcom.net>
To: <hwg-languages(at)hwg.org>
Sent: Wednesday, May 17, 2000 3:19 PM
Subject: Dopey javascript question


| Hi,
| I'm working on a site that's primarily php3. I need to put in javascript
for
| multiple buttons. There's a $sitevar that gets passed from page to page.
|
| For one call to javascript, I want to pass a form value and this $sitevar.
| so I have something like myFunction(document.form.myValue, <? print
| $sitevar ?>)
| and in myFunction(myValue, siteVar){
|
| Well, then I try to use siteVar, and I get complaints that its' not an
object.
| I know I'm doing the wrong thing in how I'm treating it, but I don't know
| how to do the right thing.
|
| In myFunction (){
| Should I do
| new Num myNum("siteVar")
|
| ?
|
| Thanks,
| Lara
|
|

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA