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

question about eval

<script>
a = "zzz:\nalert(1)";

eval(a);
</script>

Why does that work? This doesn't (not that I'd expect it to):

<script>
zzz:
aert(1);
</script>

So why does the first script work when the second one doesn't?
Mar 1 '08 #1
1 1051
On 1 Mar., 18:32, yawnmoth <terra1...@yahoo.comwrote:
<script>
a = "zzz:\nalert(1)";

eval(a);
</script>

Why does that work? This doesn't (not that I'd expect it to):

<script>
zzz:
aert(1);
</script>

So why does the first script work when the second one doesn't?
Because you misspelled alert?
Mar 1 '08 #2

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

Similar topics

5
by: Brian Angliss | last post by:
I'm relatively new to scripting in JavaScript, so I'm not too surprised I'm having difficulty scripting up an animation effect for my personal site. What I'm trying to do is the following: When...
11
by: sneill | last post by:
I have read a number of posts on the use of eval() in Javascript, and I agree that its use is questionable. But it does beg the following question: "How arbitrary does a string need to be before...
1
by: Fraggle | last post by:
I have a repeater with controls added at run time. the <template> also contains a <asp:textbox that is made visible on some repeater elements. when I come to read the text info out it has...
0
by: Logan McKinley | last post by:
I have a datalist that takes two clicks to show the SelectedItem or UpdateItem. The first click seems to fire the event but does not seem to change the page, the second click doesn't fire the...
1
by: Chris | last post by:
Hey Okay using DataBinder.Eval in a repeater. My question is this - if the value is empy, eg the myDownloadFile is empty, how can i display different output than if it was populated. #...
10
by: Patrick Olurotimi Ige | last post by:
I have a checkbox and i want to input Char "Y" or "N" to the Table In C# we could use for example :- ptrTest.Value = chkYN.Checked ? "Y" : "N"; Whats the equivalent in VB.NET?
4
by: jdc_1040 | last post by:
Could someone explain what the scope chain looks like to code running inside eval? (Please no "eval is the devil" essays :) ) Let's say I have a string of JavaScript that looks like this: var...
0
by: erin.sebastian | last post by:
Hello All, I have created a web page. At the top of the page there are 4 links; upon clicking on one of the links it brings up the left hand side menu, it's a repeater that loops through items...
9
by: peashoe | last post by:
I need to create a javascript that not only changes a picture, but also the link: here is an example of what I need www.myweddingfavors.com/ I'm working on this website and have it half done:...
7
by: Helpful person | last post by:
I am new to Javascript and have a fairly straightforward question. I am trying to use an image as a link to open a new page with the onmouseclick event. In general this seems to work fine with...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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.