Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My body onload, does not load my second page that I load in my function in other page too. So,
I need to make a button that is pre loading page . It´s possible?

What I have tried:

 <body onLoad="loadSecondPage()">
 <script type="text/javascript">
     
  window.onload = loadSecondPage();

 </script>    
            <input type="button" onclick="LoadSecondPage();" value="   ">
<!--

ignore..
            <input type="button" <a href="index.html" value="Voltar">

<input type="button" onclick="location.href='index.html';" value="Voltar"/>


-->
Posted
Updated 3-May-17 4:10am
v3

1 solution

Just set a button redirect to the page you want to go.
Don't know to reason why you would pre-load your page but IIS or Appache can pre-load you page. You don't have to worry about that.

iis: pre load settings

If the page is on what kinda reason slow than fix that problem.
 
Share this answer
 
Comments
MarkNopfler 3-May-17 10:15am    
What I wanna make is only to call my function, as the page don´t load my script, so I inserted the button to load the script, but for this , I have that click in my button to show this. So I wanna make a button pre clicked.

To call another page is not my intention.
I´m using phonegap, maybe be for this reason that it not function.
Wessel Beulink 3-May-17 10:28am    
Is the LoadSecondPage() function on the same page? Maybe you can post the script in your solution. I would suggest you to use document on ready like this fiddle: https://jsfiddle.net/pitasato/9xuxntpL/
MarkNopfler 3-May-17 10:41am    
It works of same form, but show me a follow error:" Uncaught TypeError: Cannot read property 'transaction' of null"

code| index2.js

function pesquisarTela(){

var recebe = $.urlParam('id_titulo');

alert("id= "+recebe);


// var var_texto = document.getElementById("texto").value;
//var var_query = "SELECT * FROM estudos WHERE titulo like '%"+var_texto+"%' ";
// var var_query = "SELECT * FROM vtestudos WHERE vtestudos MATCH '*"+var_texto+"*' ";

var teste="select titulo,texto from vtestudos where id_titulo="+recebe;
//var teste = "select * from vtestudos";
//var var_query = "SELECT * FROM vtestudos WHERE vtestudos MATCH 'teste' ";
//alert(var_query);

//var var_query = "SELECT count(*) as qtd FROM vtestudos";

--- show me error in this line --> db.transaction(function(tx) {
tx.executeSql(teste, [], function(tx,res){
//alert(res.rows.length);
//alert(res.rows.item(0).qtd);

if(res.rows.length > 0)
{
var var_div_retorno = "";
for (var i = 0; i < res.rows.length; i++){

var var_div_retorno = var_div_retorno + "";

var var_div_retorno = var_div_retorno + "";

var var_div_retorno = var_div_retorno + ""


}
var var_div_retorno = var_div_retorno + "";
var var_div_retorno = var_div_retorno + res.rows.item(i).titulo;
var var_div_retorno = var_div_retorno + "";
var var_div_retorno = var_div_retorno + res.rows.item(i).texto;
var var_div_retorno = var_div_retorno + ""
var var_div_retorno = var_div_retorno + ""
var var_div_retorno = var_div_retorno + "";
}

//alert(var_div_retorno);
document.getElementById("div_retorno").innerHTML = var_div_retorno;

});
}, function(err){
alert(err.message);
});

}

So, looks like me insolvable ...
Wessel Beulink 3-May-17 10:55am    
This is a database error: 'Uncaught TypeError: Cannot read property 'transaction' of null"'
I should post that in a new question and accept this one. Can be everything.
If you comment all your database lines in the script it works?

MarkNopfler 3-May-17 12:06pm    
Right. If I comment all command line part that envolve database , so IT don´t will return the values, but follow without errors.. But I need from my line that envolve database in command line.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900