473,396 Members | 2,002 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,396 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 2279
"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.