473,387 Members | 1,481 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.

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 6714
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...

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.