473,387 Members | 1,404 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,387 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 9213
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 search.php, data is received and stored in variables...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.