Jump to content

How to run a function in on load


waterinfo

Recommended Posts

Add to UniserverModule.CustomFiles

http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

 

Add to MainForm.Script

$(function() {
alert('Hello!');
});

 

However it will run before UniGui shows main form since it is initialized via ajax later.

If you want to execute after main form is shown, use it's ClientEvents.

Link to comment
Share on other sites

Dear zilav,thank for u excellent suggestion!

 

But's still make me fuse when many google's demo script can by load by my program,can u give me any more suggestion like this:

 

 

 

 

<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
   <title>
     Google Visualization API Sample
   </title>
   <script type="text/javascript" src="http://www.google.com/jsapi"></script>
   <script type="text/javascript">
     google.load('visualization', '1', {packages: ['gauge']});
   </script>
   <script type="text/javascript">
     function drawVisualization() {
       // Create and populate the data table.
       var data = new google.visualization.DataTable();
       data.addColumn('string', 'Label');
       data.addColumn('number', 'Value');
       data.addRows(3);
       data.setValue(0, 0, 'Memory');
       data.setValue(0, 1, 80);
       data.setValue(1, 0, 'CPU');
       data.setValue(1, 1, 55);
       data.setValue(2, 0, 'Network');
       data.setValue(2, 1, 68);
     
       // Create and draw the visualization.
       new google.visualization.Gauge(document.getElementById('visualization')).
           draw(data);
     }
     

     google.setOnLoadCallback(drawVisualization);
   </script>
 </head>
 <body style="font-family: Arial;border: 0 none;">
   <div id="visualization" style="width: 600px; height: 300px;"></div>
 </body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...