473,220 Members | 2,164 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,220 software developers and data experts.

why does JS give runtime error?

I have included in my html code (SRC) a file that I want Javascript to
ignore, but PHP to execute (if parsed by PHP)

the js function is:
function justphp(f) {
$test="<?php die(); ?>";
return;
}

In javascript the variable $test is just a string and will never be used,
but in PHP it will die when executed.
whenever I read it as javascript though I get a runtime error:
Line 2: Error: Unterminated string constant.
PHP works fine.
But my string IS terminated! Why does it not just assign the string and
ignore it, like it is supposed to...
Or what am I missing?

Thanks for any comments you may have,

John.

(IE6, win98)
Jul 20 '05 #1
1 2270
"JohnS" <Pl**********@myaccount.com> writes:
I have included in my html code (SRC) a file that I want Javascript to
ignore, but PHP to execute (if parsed by PHP)

the js function is:
function justphp(f) {
$test="<?php die(); ?>";
return;
}

In javascript the variable $test is just a string and will never be used,
but in PHP it will die when executed.
The PHP is executed on the server, long before the javascript is
executed on the client. If the "die" function stops PHP execution,
then I bet the rest of the page from there is never sent to the browser,
including the end quote.
whenever I read it as javascript though I get a runtime error:
Line 2: Error: Unterminated string constant.
PHP works fine.
But my string IS terminated! Why does it not just assign the string and
ignore it, like it is supposed to...
Or what am I missing?


What is the code that is sent to the browser? I bet the answer is in
there, since that is the code that contains the error.

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

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

Similar topics

4
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
2
by: Pavils Jurjans | last post by:
Hello, This is my test.aspx page: <%@ Page Language="C#" enableSessionState="true" inherits="MyPage"%> This is code in CodeBehind.cs: using System;
2
by: Tom | last post by:
I'm getting this error when I try to pass a structure to a dll. An unhandled exception of type 'System.ArgumentException' occured in Test1.exe Additional Information: Type could not be marshaled...
2
by: rajaraja | last post by:
Hi All, In my UI Layer I am raising the Exception Divisible by Zero. In Catch block of UI Layer I am calling the Business layer function to write this exception into Event Viewer ...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
52
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member...
1
by: jabbari | last post by:
Hello, Please Help us...! I have a big problem ,so i searched on google and other search engine ,then I realized that so many other people have the same problem and they, all, have'nt been able to...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.