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

Passing & (ampersand) to a new window

Hi

Pretty simple, I am sure. I have a small JS script, which is

function OpenSomething(input)
{
win3=window.open("some_file.php?info=" +
input,"mywin","width=500,height=600,scrollbars=yes ,resizable=yes");
return false;
}

The problem is that "input" comes from a text box, and can contain
ampersand.
All I need is to replace ampersand with %26, and do the same in PHP
(which I know how to do).
But how do I do that in JS?

WBR
Sonnich
Nov 22 '07 #1
3 5576
jodleren said the following on 11/22/2007 9:00 AM:
Hi

Pretty simple, I am sure. I have a small JS script, which is

function OpenSomething(input)
{
win3=window.open("some_file.php?info=" +
input,"mywin","width=500,height=600,scrollbars=yes ,resizable=yes");
return false;
}

The problem is that "input" comes from a text box, and can contain
ampersand.
All I need is to replace ampersand with %26, and do the same in PHP
(which I know how to do).
But how do I do that in JS?
About the same way you do in PHP, you replace it.

newInput = input.replace(/&/g,'%26')

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 22 '07 #2
On Nov 22, 2:00 pm, jodleren <sonn...@hot.eewrote:
The problem is that "input" comes from a text box, and can contain
ampersand.
All I need is to replace ampersand with %26, and do the same in PHP
(which I know how to do).
But how do I do that in JS?
http://developer.mozilla.org/en/docs...deURIComponent
--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/
Nov 22 '07 #3
On Nov 22, 4:25 pm, David Dorward <dorw...@gmail.comwrote:
On Nov 22, 2:00 pm, jodleren <sonn...@hot.eewrote:
Thanks!
Nov 22 '07 #4

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

Similar topics

5
by: Magnus Warker | last post by:
Hi, when I try to pass some parameters in an URL, I always get an URL where the ampersand is represented as '&amp;'. I tried: $url = "wsp.php?mod=$mod&sec=$sym"; $url = "wsp.php?mod=$mod" ....
2
by: hstockbridge5 | last post by:
Hi, My company's Exchange team created a mailbox for our department with an ampersand in the SMTP e-mail address (e.g. ABCD&EFG@domain.com.) Is it possible to create a mailto link that can...
12
by: ~~~ .NET Ed ~~~ | last post by:
Hi, I have a standalone XML file (with the appropriate xml document header) that works fine when I load it using XmlDocument. I can have child elements like this without problems: ...
1
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return chars in the .innertext to XML-compliant " "; It...
1
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
28
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
3
by: gg | last post by:
I specify the Url element as <xsd:element name="Url"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="512"/> <xsd:pattern value="http://+"/> </xsd:restriction>...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
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
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:
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...

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.