Free Android CakePHP GMaps Articles by Bali Web Design

September 20, 2008

How to load javascript file on window on load

Filed under: html,javascript — Tags: , — admin @ 7:36 pm

Here is another way to load a javascript file on window on load.

<script type="text/javascript">
window.onload = function () {
var script = document.createElement("script");
script.src = "site/js/3000297746.js";
document.body.appendChild(script);
};
</script>

July 29, 2008

How to post form into a popup window

Filed under: html,javascript — Tags: , — admin @ 10:04 am

When you need to send a variable to a popup window from mainpage, ussually we will put it in url as GET method. But using this problem we will get problem when the variable has long character. We know that GET has limited long.

So we need to use POST method to submit a form. But how we can do it? I have a trick how to do it.

First we create a javascript for handling onsubmit event on html form.

function thePopupWindows(windowsname){
var win = window.open('', windowsname, ''width=580,height=450');
return true;
}

and then set this function on HTML Form :

<form action="popupwin.php" method="post" target="thepopup" onsubmit="return thePopupWindows(this.target);">
<input id="name" name="name" type="text" />
<input type="submit" value="Submit">
</form>