473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help me: Querystring with JScript

I know the syntax for variable "variabletopass" in ASP:

www.destinationpage.asp?variable=<%=variabletopass %>

What's the syntax for Javascript?

Thks
Dec 10 '06 #1
11 2970
ASM
Fabio a écrit :
I know the syntax for variable "variabletopass" in ASP:
But I don't know asp
www.destinationpage.asp?variable=<%=variabletopass %>

What's the syntax for Javascript?
To send variable :

location.href = 'www.destinationpage.asp?variable='+myVariable;
To querry string :

var url = self.location.search;

// will return : '?variable=trucmachinchose'

To get value with an alone variable :

myVariable = url.split('=')[1];
i.e. :

<body onload="alert('variable = '+self.location.search.split('=')[1])">
How I do with several variables (direct script in head) :

<html>
<script type="text/javascript">
var url = self.location.search.toString();
if(url.indexOf('?')==0) {
url = url.substring(1)
if(url.indexOf('&')>0)
{
var vars = url.split('&');
for(var i=0; i<vars.length; i++)
{
var v = vars[i].split('=');
alert(v[0]+' = '+v[1]);
eval(v[0] +'="' + v[1] + '"');
}
}
else
myVariable = url.split('=')[1];
}
</script>
<body onload="alert('variable = '+self.location.search.split('=')[1])">

<a href="?">example zero</a>
<a href="?avar=ASM">example one</a>
<a href="?avar=ASM&Name=Moriaux&Surname=Stephane">exa mple two</a>
<a href="#"
onclick="if(typeof(myVariable)!='undefined')
alert('myVariable = '+myVariable);
else
if(typeof(vars)!='undefined')
alert('name = '+Name);
else alert('no variable');
return false;">control</a>
</body>
</html>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Dec 10 '06 #2
Ok, I got it.
But how can I target my link in a frame? The string:

onclick="parent.FRAMEDESTINATION.location.href=..

doesn't work ("FRAMEDESTINATION is not defined")

Thks
Dec 10 '06 #3
ASM
Fabio a écrit :
Ok, I got it.
But how can I target my link in a frame? The string:

onclick="parent.FRAMEDESTINATION.location.href=..

doesn't work ("FRAMEDESTINATION is not defined")
so you have do define it ... no ?

<frame name="FRAMEDESTINATION" ... >

caution : name and not id !

Anyway, better to have the JS in file displayed in correct frame.
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 10 '06 #4
<frame name="FRAMEDESTINATION" ... >

caution : name and not id !

It doesn't work: the target frame has its name, "centro", but I've the same
error:

"parent.centro.location is null or not object"

What can I do?

Thks


Dec 10 '06 #5
ASM
Fabio a écrit :
><frame name="FRAMEDESTINATION" ... >

It doesn't work: the target frame has its name, "centro", but I've the same
error:
Not me
"parent.centro.location is null or not object"

What can I do?
to have a look to my demo ?
http://stephane.moriaux.perso.wanado...s_n_variables/

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 11 '06 #6
It doesn't work, because I need to target the link to a frame ("center") of
another open window, NOT to a frame of the same window. What can I do?

My string is:

<span class="rosso"
onclick="parent.center.href='frame_ricercamusica_r esponso.asp?parolachiave='
+keyword; return false">Click here!</span>

Thks.

Fabio
Dec 11 '06 #7
ASM
Fabio a écrit :
It doesn't work, because I need to target the link to a frame ("center") of
another open window, NOT to a frame of the same window. What can I do?
Più forte del Roquefort !

Say you did open your popup :
popi = window.open( ... );

Perhaps this could work :

onclick="popi.center.href='frame_ricercamusica_res ponso.asp?parolachiave='
+keyword; return false">Click here!</span>
<span class="rosso"
onclick="parent.center.href='frame_ricercamusica_r esponso.asp?parolachiave='
+keyword; return false">Click here!</span>
La prossima volta si attacca il parmigiano.

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 11 '06 #8
Cerco di essere più preciso

Prima finestra: 3 frames:
"sinistro"
"centro"
"destro"

Cliccando su un bottone del frame sinistro si apre una popup di nome
"orra". Questa popup è divisa in 2 frames: "alto" e "basso"

Nel frame "basso" di questa popup c'è un link che dovrebbe farmi aprire una
pagina nel frame
"centro" della prima

Spero sia stato chiaro :-) Grazie

Fabio
Dec 12 '06 #9
ASM
Fabio a écrit :
Cerco di essere più preciso
Si nuota nel formaggio bianco :-)
Prima finestra: 3 frames:
"sinistro"
"centro"
"destro"

Cliccando su un bottone del frame sinistro si apre una popup di nome
"orra". Questa popup è divisa in 2 frames: "alto" e "basso"

Nel frame "basso" di questa popup c'è un link che dovrebbe farmi aprire una
pagina nel frame
"centro" della prima
You could try :

parent.opener.centro.location = 'laMiaMeravigliosaPagina.htm'
Spero sia stato chiaro :-) Grazie
In francese questo mi avesse l'avuto potuto :-)

HTH
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 12 '06 #10
parent.opener.centro.location = 'laMiaMeravigliosaPagina.htm'
Non funziona :-(
Dec 12 '06 #11
ASM
Fabio a écrit :
>parent.opener.centro.location = 'laMiaMeravigliosaPagina.htm'

Non funziona :-(
parent.opener.parent.centro.location.href = ' ... ';

tested in Firefox !
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 13 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hans | last post by:
Is it possible to put a unicode string on a querystring? How do I escape/unescape this? I read values from a dropown list which may have any UTF-8 character (chinese, greek or whatever). If it...
9
by: Peter | last post by:
My problem is the last bit of coding below, the like statement does not work. what I have is a product options field and in it is stored characters i.e. "avcy" etc what the query does is...
2
by: Davíð Þórisson | last post by:
hi in my old Asp pages I used Jscript as below that is a single .asp page would contain various subcodes. Is it the same in Asp.net? switch (Request.QueryString("handler").Item) { case "load":...
5
by: Chris | last post by:
Hi, I was following the article http://msdn.microsoft.com/msdnmag/issues/03/12/DesignPatterns/default.aspx I got everything working until I go the the Progress bar section. Here is where I am...
1
by: aarthy | last post by:
Hi, I have a problem in the display of the ASP screen actually i am retrieving and displaying the data from a database when the view button is hit.The contents for display is so long so i want...
3
by: beachboy | last post by:
I have a problem if the parameter has a "&" symbol in querystring, i think asp.net will split the value into 2 values as "&" is a spliter any advise can give me to solve this problem? P.S. I...
1
by: JNariss | last post by:
Hello, I have created a connection to my Access database with Dreamweaver and made a simple form with 4 fields. The code behind this form was/is: <%@LANGUAGE="VBCRIPT" CODEPAGE="1252"%>...
9
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A...
1
by: Andrew Wan | last post by:
How can VBScript code access JScript code variables in the same ASP page? <SCRIPT LANGAUGE="VBScript"> Dim a a = 10 </SCRIPT> <SCRIPT LANGUAGE="JScript"> Response.Write(a); </SCRIPT>
3
by: pbd22 | last post by:
Hi. I need some help with structuring my query strings. I have a form with a search bar and some links. Each link is a search type (such as "community"). The HREF for the link's anchor looks...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.