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

Why doesn't parser like this script?

Hi, I'm using the following script to pass 3 variables to my next
form.

function Anomaly(typeIn,idIn,textIn)
{
var sType = 'type=' typeIn
var sIdNo = '&idNo=' idIn
var sText = '&text=' textIn

newWindow = window.open(('Anomaly.aspx?' + sType + sIdNo + sText),
'Anomaly', 'width=650')
}

My parser (msxml4) "thinks" there is a problem with variables sIdNo
and sText -- the &'s are causing it (expecting a semicolon after
'&idNo='). It functions but I don't want the user to see the browser
error...how else to I pass the multiple parameters?

Any thoughts?

Thanks, Kathy
Jul 20 '05 #1
3 1485
Ka**********@attbi.com (KathyB) writes:
var sType = 'type=' typeIn
Do you mean:
var sType = 'type=' + typeIn

(and I would add a semicolon at the end, even though it isn't necessary).
var sIdNo = '&idNo=' idIn
var sText = '&text=' textIn


Dittos.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2


KathyB wrote:
Hi, I'm using the following script to pass 3 variables to my next
form.

function Anomaly(typeIn,idIn,textIn)
{
var sType = 'type=' typeIn
var sIdNo = '&idNo=' idIn
var sText = '&text=' textIn

newWindow = window.open(('Anomaly.aspx?' + sType + sIdNo + sText),
'Anomaly', 'width=650')
}

My parser (msxml4) "thinks" there is a problem with variables sIdNo
and sText -- the &'s are causing it (expecting a semicolon after
'&idNo='). It functions but I don't want the user to see the browser
error...how else to I pass the multiple parameters?

Any thoughts?


MSXML 4 is an XML parser, if you are using it to parse HTML pages then
forget about that. If you are trying to author XHTML then you need to
follow XML rules where you would need to use
&amp;
to escape an ampersand. However as you are probably trying to send XHTML
as text/html to HTML browsers you need another approach, one way is to
not use inline scripts but only external script files, another way is to use
<script type="text/javascript">
//<![CDATA[
script goes here
//]]>
</script>
that way your page is well-formed XML while being properly handled by
HTML browsers.
I (and others) however strongly suggest to use HTML 4.01 instead of
XHTML 1.0, see for instance
http://www.hixie.ch/advocacy/xhtml

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
It _might_ be because you are missing + in your var calls.

var sType = 'type=' + typeIn;
var sIdNo = '&idNo=' + idIn;
var sText = '&text=' + textIn;

Best way to test is try:-

function Anomaly(typeIn,idIn,textIn)
{
var sType = 'type=' + typeIn;
var sIdNo = '&idNo=' + idIn;
var sText = '&text=' + textIn;
alert('Anomaly.aspx?' + sType + sIdNo + sText);
}

This will alert the total url line that is openeing in your popup window.

Stu

"KathyB" <Ka**********@attbi.com> wrote in message
news:75**************************@posting.google.c om...
Hi, I'm using the following script to pass 3 variables to my next
form.

function Anomaly(typeIn,idIn,textIn)
{
var sType = 'type=' typeIn
var sIdNo = '&idNo=' idIn
var sText = '&text=' textIn

newWindow = window.open(('Anomaly.aspx?' + sType + sIdNo + sText),
'Anomaly', 'width=650')
}

My parser (msxml4) "thinks" there is a problem with variables sIdNo
and sText -- the &'s are causing it (expecting a semicolon after
'&idNo='). It functions but I don't want the user to see the browser
error...how else to I pass the multiple parameters?

Any thoughts?

Thanks, Kathy

Jul 20 '05 #4

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

Similar topics

9
by: none | last post by:
Howdy all, I'm wondering if someone could give some direction on a problem I have or share their experiences. I'm wanting to create a little PHP application that will run on a local machine...
4
by: Peter Row | last post by:
Hi, I have 2 XML files and 1 XSLT file. The second XML file has the following declarative 1st line: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ....the 1st one (the one to be...
7
by: jagsmiles | last post by:
Hi Friends, I have to perform a lot of editing of xml data on the client-side(browser), using javascript. (before i display the data on the browser). Which xml parser is better for accessing...
0
by: Bob Bedford | last post by:
Hi all, I've to parse XML files on the fly and I must admit I'm far away to understand why the parser are done. The files I receive have all the same structure, and due to limitations of my...
2
by: Joel Hedlund | last post by:
Hi! I have a possibly dumb question about imports. I've written two python modules: parser.py ------------------------------------ class Parser(object): "my parser"...
0
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): ...
3
by: jeremy.gehring | last post by:
Hey all, OK I'm not much of a PHP programmer; but needs must as they say. I have written AJAX file upload system that uses a PERL CGI script so that a PHP script can get the progress (nifty...
4
by: manu | last post by:
Hi, I need to parse xml files for the Blender Game Engine. ATM I am trying to get this script running in the BGE. This is my first script and I dont have much experience programming... import...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...

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.