Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Encountering spaces breaks function.
Old 06-17-2008, 09:57 AM Encountering spaces breaks function.
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
In the following function if for example params[3] = "Pkg=Burlap Sack" the var Pkg will be assigned as "Burlap" and the function will break.

Code:
 
function Init(){
try
{
var page = location.href.split(/\?/); 
var params , pair;
params = page[1].split(/&/);
CustID=params[0].replace("CustID=","");
MenuItem=params[1].replace("MenuItem=","");
ProdID=params[2].replace("ProdID=","");
Pkg=params[3].replace("Pkg=","");
 alert(Pkg)
Sze=params[4].replace("Sze=","");
 alert(Sze)
Flv=params[5].replace("Flv=","");
 alert(Flv)
Dsc=params[6].replace("Dsc=","");
 alert(Dsc)
Inf=params[7].replace("Inf=","");
 alert(Inf)
Ech=params[8].replace("Ech=","");
 alert(Ech)
Shp=params[9].replace("Shp=","");
PassStr="Panel.asp?CustID="+CustID+"&MenuItem="+MenuItem+"&ProdID="+ProdID+"";
}
catch(e)
{
}
ImgStr="http://www.webmaster-talk.com/images/Products/"+ProdID+".png";
document.images[0].src=ImgStr;
}
could it have something to do with charset?

Last edited by Sleeping Troll; 06-17-2008 at 10:04 AM.. Reason: More info
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-17-2008, 04:22 PM Re: Encountering spaces breaks function.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.w3schools.com/jsref/jsref_escape.asp
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Encountering spaces breaks function.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.84890 seconds with 12 queries