472,328 Members | 1,206 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Javascript Keep data form after reload

Hello:

I tried an script for keep my data form after reload page, but I've some errors.
In this momento I runnung my own browser because we've an intranet. And for security reason, our page reload every 10 minutes for keep my login live.
But, we've some forms, and 10 minutes is a shorcut time to do that, and very 10 minutos, our page reload, and we lose all data in form (before submit).
So, for that reason , I want to keep my data after reload, but clear after submit.

My problem right now is, I've a javascript, keep my data, BUT every time I access to that page appear an syntax error.

<head>

<SCRIPT Language="JavaScript">
<!--

var url_str = window.location.toString();
var url_split = url_str.split('?');

else
{
var var_split = url_split[1].split('&');
x = 0;
i = 0;
while (i < var_split.length)
{
curr_val = var_split[i].split('=');
document.form1[x].value = curr_val[1];
x = x+1;
i = i+1;
}
}
}

//-->
</SCRIPT>
</head>

<BODY>


<FORM Name="form1" Method="get" Action="example.html">
<INPUT Type="text" Name="1">
<INPUT Type="text" Name="2">
<INPUT Type="submit" Value="Post">
</FORM>
Once you have completed the form to save click post then bookmark this page.

</BODY>


The error appear in
Line: 11
char: 1
error: syntax error
code: 0

Somebody knows what happen with this script?

Thank you for your help
Nov 14 '06 #1
3 9129
ronverdonk
4,258 Expert 4TB
Do you want me to guess what it could be?? What is line 11?

Ronald :cool:
Nov 14 '06 #2
Do you want me to guess what it could be?? What is line 11?

Ronald :cool:
hahahaha. Im sorry Ronald. Is my fault!

the line 11 is the else.
Here:

else
{
var var_split = url_split[1].split('&');

That "else" show me error in explorer and I dont know why.
I really appreciate your help.
Thank you
Niko
Nov 14 '06 #3
pronerd
392 Expert 256MB
Is there more to the script than is shown? The else needs to have an If before it, and I see two opening braces, but three closing ones.

Assuming that there is an if statement that is just now shown, and assuming that there is only one "?" to split on then the array pointer should be 0 not 1. The first value in arrays is zero.
Nov 14 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: EOZyo | last post by:
Hi, i'm trying to set pagination for a search i run on my website, i'll try to explain the easiest i can: When i click the search button on...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

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.