473,289 Members | 1,896 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,289 software developers and data experts.

problem using javascript to get querystring

my Problem:
a query string passed into a html page doesn't display correctly on a
mac
I am just using html and javascript (no ASP, PHP or server side
scripting)

This is the query string:
popup.html?pImage=30_leilani_dowding_b_060.jpg&ord Ref=1000&Title=Leilani Dowding

using the QueryString function below, the pImage variable should be
equal to: 30_leilani_dowding_b_060.jpg
on a PC this is correct BUT on a mac it is displayed as:
'30_leilani_dowding_b_06030_leil'?

Has anyone experienced this problem?

cheers, lion

javascript to to display the image
<SCRIPT LANGUAGE="JavaScript">
document.write("<img src=images/wallpapers/"+pImage+" width='128'
height='128'>");
</script>

javascript function to get query string:
function QueryString(key)
{
var value = null;
for (var i=0;i<QueryString.keys.length;i++)
{
if (QueryString.keys[i]==key)
{
value = QueryString.values[i];
break;
}
}
return value;
}
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
var query = window.location.search.substring(1);
var pairs = query.split("&");

for (var i=0;i<pairs.length;i++)
{
var pos = pairs[i].indexOf('=');
if (pos >= 0)
{
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
QueryString.keys[QueryString.keys.length] = argname;
QueryString.values[QueryString.values.length] = value;
}
}

}

QueryString_Parse();

//set up the variables
//ordRef gets the order Number used i.e: 1000
var ordRef = QueryString("ordRef");
//
//Title gets the title passed e.g: Jordan&nbsp;Coldanski
var Title = QueryString("Title");
//
//pImage gets the image name including extension pImage=Jordan128.gif
var pImage = QueryString("pImage");
//
Jul 23 '05 #1
1 6708
See the escape() and unescape() function. Use it to correctly encode
your query strings.

For example 'test.html?foo='+escape('big bar')

Jul 23 '05 #2

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

Similar topics

4
by: Eifion | last post by:
I've noticed a strange problem with setting cookies in ASP when the cookie name you're setting exists in the querystring. The company I work for has many partner sites who link to our site like...
0
by: Randy | last post by:
I'm using Crystal.net version 9.0 in a aspx page using the CrystalReportViewer server control. When I view a report running locally on my server where I installed the crystal off the CD, the...
1
by: Fastly | last post by:
Hi Guys I'm no Javascript guru, although am fairly confidant using PHP... What I have knocked together here uses PHP to create a querystring without the iso=XX value, and dump it's output within...
2
by: Ophir | last post by:
Hello all I have this problem: I'm displaying a loggin page. If the user entered an invalid UserName/Password I display the page again. When this happens I want to give the user a different...
1
exoskeleton
by: exoskeleton | last post by:
Hi..to all expert...i have this situation .. i cant get the value of the file field in the other page..im using a simple javascript like this... example: // this is page1.php <head> ...
5
by: althafexcel | last post by:
hi everyone Im trying to include an external js in my aspx page under the head tag, it doesn't load or it displays an object expected error whenver the function from the .js is called. Actually...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
1
by: sudip2008 | last post by:
When using the Calendar Popup in a content page of a masterpage the strForName is always set to aspnetForm This breaks this line from working properly window.opener.document.forms...... How can...
5
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, It's been a while, I've got a small problem that I could do with your expertise on. As you know (I Think) I build websites for recruitment agencies, part of the website includes a job...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.