Eval And Continue

Aug 23, 2005

I'm having some weird problem with evaluating the continue statement.
Within a for loop I'm trying to evaluate a string (generated somewhere
earlier) which basically has the continue statement in it. IE6 seems to
have major problems with that as it generates an error "Can't have
'continue' outside of loop". Does anyone know why and/or have a
workaround? I haven't tried any other browser since this one is the
only one available (company policy).

I have included some code to reproduce this behaviour. The first and
second if statements of the testeval function behave as expected. The
third one however produces the mentionned error. Code:

View 6 Replies


ADVERTISEMENT

Only Continue If Key Pressed Was Alphanumeric

Jul 9, 2006

I need to stop a function from continuing if the key pressed wasn't alphanumeric or a hyphen. how can this be achieved?

View 1 Replies View Related

How To Get An Alert To Continue Every 10 Seconds.

Apr 11, 2007

I have this below which causes an alert after 10 seconds. How would I keep the alert going every 10 seconds after?

<script type="text/javascript">
//If the time is less than 10,
//you will get a "Good morning" greeting.
//Otherwise you will get a "Good day" greeting.

var d = new Date();
var time = d.getSeconds();

if (time > 10)
{
alert("Hello day!")
}
</script>
</body>
</html>

View 7 Replies View Related

JQuery :: Bind A Click Then Continue?

Apr 20, 2011

I'm looking for a way to catch a click on a link, show a popup message then... continue with the action.

[Code]...

View 4 Replies View Related

JQuery :: Stop Form From Submitting Then Continue Once Done

Jul 19, 2011

There are several forms on this page and I have absolutely no control over them. The page is provided by a 3rd party and all we can do is add javascript.

The form is a google checkout. I need to halt submission (preventDefault) do some stuff and continue the submittion of that form.

This is what I have:

The FORM:

The SCRIPT:

View 4 Replies View Related

Check Off All Three Boxes Before 'continue' Button Becomes Active.

Aug 21, 2009

I have a page with three items that I want the user to agree to (a beta signup agreement).I want them to have to check off all three boxes before the "continue" button becomes active. I've searched and searched and found a few tutorials, but they only seem to get me halfway and then drop me off a cliff.I don't need this to be a submit form or anything, just click the three boxes and then you can hit the "continue" button.

View 5 Replies View Related

Script For Loop That Seems To Continue To Load Page While In FireFox?

Sep 22, 2009

Below is some very basic html/javascript that asks for a user to enter a number in an input text box and then a button is pressed it writes out a line that number of times. It works, but when run in firefox the pages always seems to continue to load...that is, the cursor is continuously that when a page is loading (an arrow with a little circle) and the status bar in the bottom right hand corner seems to be always be at zero. It seems to be something in the for loop as when this is take out it works. Seems to work in IE however?Is this a FireFox thing or am I not terminating the loop properly?

<html>
<head>
<script type="text/javascript" language="javascript">[code]....

View 6 Replies View Related

JS Function Use To Force A Time Delay Without Having The Code Continue To Run?

Aug 1, 2011

Is there another JS function that I can use to force a time delay without having the code continue to run? I'm using the setTimeout() function but the call to this function doesn't stop the code flow. I need to stop the code flow while waiting. I guess I need a Sleep() type of JS function.What I'm trying to do is display some blank text on the screen using a for loop (I'm using  <BR> to give the appearance of "opening up" a vertical window section in the browser) and I need this 'text' to complete before allowing the following code in the function to execute. The following code will display a Table with rows of data. I'm trying to use a timing function to give a visual impression of a window opening up just before the data displays.

View 1 Replies View Related

Slides Down A Window With A Yes / No Box To Continue On To Another Page - Doesn't Work In IE?

Jan 31, 2011

it's a layer that slides down a window with a yes/no box to continue on to another page.

[Code]....

View 3 Replies View Related

Use Continue Button To Determine Which Checkbox Was Clicked And Redirect To Correct Page?

Feb 24, 2011

I have several checkboxes in a switch statement like the one below:

How can I use a continue button to determine which checkbox was clicked and redirect me to the correct page?

View 2 Replies View Related

Eval() How Else

Jul 23, 2005

given that I have a js file included which is written programatically and I
can't change it. I would like to know how to do the following using
something other than the deprecated eval().

whats in the js file
var numArrays=something;
var data0 = new Array();
data0.name="name";
data0.data="some data";
var data1 = new Array();
data1.name="another name";
data1.data="some more data";
etc ....
function getData(arrayName) {
for ( var i=0;i<numArrays:i++) {
var el=eval('data'+i);
if (arrayName = = el.name) doSomething(el.data);
}}

View 4 Replies View Related

How To Use Eval?

Jul 23, 2005

var fns = ['orde', 'no', 'kml', 'snf', 'td', 'ty', 'tn', ...up to 21
elms...];
var snv = new Array();

var vals = new Array();
for (i = 0; i < N; i++) {
for (j = 0; j < fns.length; j++)
vals[j] = some value;
snv[i] = new makeData(vals);
}

function makeData(vals) {
for (k = 0; k < vals.length; k++)
//the following line doesn't work
eval("this."+fns[k]+"="+vals[k]);
//neither this one
this.eval(fns[k]) = vals[k]);
}

how can i make it without writing it the long way:

this.orde = vals[0];
this.no = vals[1];
this.kml = vals[2];

and so on?

View 7 Replies View Related

Need The [] In Eval

Nov 16, 2006

how comes the following doesnt work

fieldNotes2=eval("Message.notes["+id2+"]");

i believe it's because of the [] but i need to keep them!

View 9 Replies View Related

Using Eval()

Jan 28, 2004

I've made a funny program using eval()...it will let the person(on the page) to write javascript and have it compile(if thats the right word for it)! its quite cool, i dont know how handy it might be, but here it is none the less...

code:

<html>
<head>
<title>test</title>
<script language="JavaScript">

function submitCode(){
var the_code = window.document.form_1.textarea_1.value;
var run_the_code=eval(the_code);
}

</script>
</head>
<body>
<center>
<h1>write some code!</h1>
<form name="form_1">
<textarea name="textarea_1" rows=10 cols=40>
</textarea>
</form>
<form onSubmit="return false;">
<input type="submit" value="submit your code" onClick="submitCode();">
</form>
</center>
</body>
</html>

very simple stuff, but for those of you who are unfamilir with eval, its pretty cool, huh?

View 3 Replies View Related

3 Submit Buttons - Stop Or Continue Form Execution With A Confirm Box On The Third Submit Button ?

Apr 23, 2009

On my form I have 3 submit buttons which handle different things.I am looking for a way to stop or continue form execution with a confirm box on the third submit button and the third only.I can't use onsubmit because that will trigger on all three buttons.

View 2 Replies View Related

Random Photo + Rotation Query - Continue From The Random Image And Change To The Next Every 3 Seconds?

Aug 31, 2011

I'm trying to use Javascript to have an array of images that load randomly AND work in a slideshow manner so change every 3 seconds (in a logical order). The code I have below presents a random image but how do I get them to continue from the random image and change to the next every 3 seconds?

<script language="JavaScript">
images = new Array(3);
images[0] = "<a href = 'photo1.html'><img src='images/photo1.jpg' alt='Photo 1'></a>";
images[1] = "<a href = 'photo2.html'><img src='images/photo2.jpg' alt='Photo 2'></a>";
images[2] = "<a href = 'photo3.html'><img src='images/photo3.jpg' alt='Photo 3'></a>";
[Code]...

View 4 Replies View Related

Javascript Eval

Feb 2, 2006

I am trying to do the following but i get an error, is there no way i
can use eval to print have it assigned to a predeterminded variable.

eval (object_name + "_CalCalendar") = new CalendarPopup(object_name);

Cannot assign to function result.

View 2 Replies View Related

Problem With Eval

Apr 17, 2006

Here is my code.

function CallDisplay()
{
nodeobj=new mynode();
x="displayId("+nodeobj+")";
eval(x);

}
function displayId(node)
{
alert(node.myid);
}
function mynode()
{
this.myid="aa";
}

In CallDisplay() I am getting the error as "Microsoft JScript
Compilation error ']' expected". Any one can suggest me how to
overcome this.

View 8 Replies View Related

Eval Problem

Aug 30, 2006

I'm running some javascript over a server side generated web page
and have multiple generated empty select statements, that I want to
populate when the page is loaded. As HTML doesn't do arrays each
select is individually named withe MySelecti where i is an incremental
from 1.
I know all my variables are correct (i, OptionsCount) and my arrays
of MyValues and MyDescription's exist for multiple enteries and if I
bring out an example of what I thought each line would eval too( say
document.MyForm.MySelect1.options[1]=new
Option('Value1','Description1') the line works fine, for the life of me
(i'm sure I'm missing something obvious) the eval line won't eval..

for(i = 1; i<=row; i++) {
for (j = 1; j <=OptionsCount; j++) {
eval="document.MyForm.MySelect"+i+".options["+j+"]=new
Option('"+MyValues[j]+"', '"+MyDescription[j]+"')";
eval(eval);
}
}

View 3 Replies View Related

Can I Avoid Eval() Here?

Nov 23, 2006

I am trying to assign an "onclick" event to a dynamically-created DOM
element (an image).

I have read countless times that "eval()" is to be avoided at all costs.
However, I cannot seem to get my new onclick to work without it.

Here's what I have so far:

myeval = 'detachFile(this);'
detachImage = getElementById('detach-jfhahhf');
detachImage.onclick = function() { eval(myeval) }

This works perfectly fine for me, but this is a web-app that will be
exposed to public users, and I obviously don't want them being able to
eval anything if i can help it.

Can that be done without the eval()?

View 6 Replies View Related

Nifty Use For Eval()

Sep 8, 2002

i came up with the following, to help me test the syntax of functions while i'm writing them. i've only been using it for a day or two, but so far, it's been really handy.

<HTML>
<HEAD>
<TITLE>Evaluator</TITLE>

<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">

</HEAD>
<BODY>

<FORM>
<TABLE WIDTH="100%" HEIGHT="100%">
<TR>
<TD COLSPAN="2" HEIGHT="100%"><TEXTAREA NAME="script" STYLE="width: 100%; height: 100%"></TEXTAREA></TD>
</TR>
<TR>
<TD ALIGN="CENTER"><INPUT TYPE="BUTTON" VALUE="eval" OnClick="eval(this.form.script.value);"></TD>
<TD ALIGN="CENTER"><INPUT TYPE="RESET" VALUE="clear"></TD>
</TR>
</TABLE>
</FORM>

</BODY>
</HTML>

View 2 Replies View Related

Eval Function

Apr 12, 2006

In Visual Basic this is easy to do, but I'd like to do it in JavaScript (without writng my own).

I'd like to put a text box on a form so the user can type something like:

3+5*(sin(90))^2

and have the answer to the equation displayed.

I guess it would be possible to translate it into a javascrip command

x=Math.pow(3+5*(Math.sin(90)),2) and then execute the translated line using Eval(x);, but maybe there's an easier way. Any thoughts?

View 2 Replies View Related

Better Way To Evaluate Than Eval()?

Nov 3, 2010

I have a script that will loop through all the INPUT elements of a form; if the input is a submit it will disable the submit (or enable the submit, depending upon what is passed to the function.) I hate using eval() - I avoid it whenever I can! Is there a better way to dynamically process the ".disabled = 'true'/'false';" portion?

[Code]..

View 7 Replies View Related

Looking For An Eval Alternative?

Aug 29, 2009

this is the code I'm working on:

Code:
var tabs = new Control.Tabs('menu');
var pattern = 'tab=';
var nStr = location.href;
if(nStr.match(new RegExp (pattern,'gi'))){
var id = nStr.split(pattern);

[Code]...

It searches for the query string 'tabs=' and then splits the result to get the id of the tab. Then it uses this to set the active tab. If the url doesn't include the query string it set the tab to the first one.

The code works but it uses Eval to convert the id string (id[1]) to a variable and I was wondering if there was an alternative.

View 2 Replies View Related

Using Complete <script> Tag In Eval Is Possible ?

Jan 14, 2006

I am try'g to send window.location.href to the server script who will
generate dynamic javascript according to the referral name comg in as
param:

<script language="javascript" src="NO JAVASCRIPT CAN BE USED HERE" />

So I am see'g If I can use eval todo something what I am doing

I have tried almost everything, following is being last one ....

View 21 Replies View Related

Eval And Mutireplace, Which Is Faster?

Dec 26, 2006

I want to implement the template for a object output. I have two methods as follow:

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved