473,799 Members | 3,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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?pIma ge=30_leilani_d owding_b_060.jp g&ordRef=1000&T itle=Leilani&nb sp;Dowding

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

Has anyone experienced this problem?

cheers, lion

javascript to to display the image
<SCRIPT LANGUAGE="JavaS cript">
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<QueryStri ng.keys.length; i++)
{
if (QueryString.ke ys[i]==key)
{
value = QueryString.val ues[i];
break;
}
}
return value;
}
QueryString.key s = new Array();
QueryString.val ues = new Array();

function QueryString_Par se()
{
var query = window.location .search.substri ng(1);
var pairs = query.split("&" );

for (var i=0;i<pairs.len gth;i++)
{
var pos = pairs[i].indexOf('=');
if (pos >= 0)
{
var argname = pairs[i].substring(0,po s);
var value = pairs[i].substring(pos+ 1);
QueryString.key s[QueryString.key s.length] = argname;
QueryString.val ues[QueryString.val ues.length] = value;
}
}

}

QueryString_Par se();

//set up the variables
//ordRef gets the order Number used i.e: 1000
var ordRef = QueryString("or dRef");
//
//Title gets the title passed e.g: Jordan&nbsp;Col danski
var Title = QueryString("Ti tle");
//
//pImage gets the image name including extension pImage=Jordan12 8.gif
var pImage = QueryString("pI mage");
//
Jul 23 '05 #1
1 6750
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
2356
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 this: www.mycompany.com/partner.asp?PartnerID=??? The partner.asp page then sets a cookie called PartnerID containing the value from the querystring. We have noticed, however, that if the partner calls the partner.asp page and alters the...
0
1498
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 print works fine. If I view the HTML source, the print button A tag has an HREF that specifies javascript:__doPostBack However, when I view the same report on a development server where I just
1
1495
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 some Javascript code. The reason for this script is to reload a page with their country settings (i.e. state for us but not for uk) on the form. If iso=uk is already in the querystring we want to strip this from the querystring and use the...
2
4742
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 message then the one displayed when the page was initially displayed.
1
1957
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> function send() { var ajaxRequest;
5
3701
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 for repeated html im using the external js, i mean the TOP, BOTTOM they are repeated in every page, so i include them as functions in the external js and call them. Why it doesn't work?
2
3174
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 i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand whats the prob.this is the code i m using: <? include("config.inc.php"); //error_reporting(0); ...
1
8488
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 I fix this and display the date into textbox after selecting the date from Calendar.aspx? This Very Urgent .......................... If any body help me out I have given the following Code ******************************
5
3432
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 board facility and for job form entry I used a normal form with a normal textbox, however what I'm finding now is that a lot of recruitment consultants are pasting the job description into the textbox, which when submitted is resulting in most of...
0
9688
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10268
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.