hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Trigger JS function
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Trigger JS function

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-17-2008, 10:26 PM
ltsf ltsf is offline
Newbie
 
Join Date: Nov 2007
Posts: 29

Trigger JS function


Does anyone know of a way I can trigger a function call when someone changes the size of the broswer window?

Reply With Quote


Sponsored Links
  #2  
Old 06-17-2008, 10:38 PM
BurakUeda BurakUeda is offline
Retarded Noodleator
 
Join Date: Oct 2004
Location: Shimonoseki
Posts: 2,100
windows.onresize = myfunction;

__________________
Closed for winter...

Reply With Quote
  #3  
Old 06-17-2008, 10:43 PM
ltsf ltsf is offline
Newbie
 
Join Date: Nov 2007
Posts: 29
inbetween javascript tags like this

<script language="javascript">
function myFunction()
{
}

windows.onresize = myFunction();
</script>

?>

Reply With Quote
Sponsored Links
  #4  
Old 06-18-2008, 08:46 AM
Xeentech Xeentech is offline
Web Hosting Master
 
Join Date: Aug 2005
Location: UK
Posts: 655
Quote:
Originally Posted by ltsf View Post
inbetween javascript tags like this

<script language="javascript">
function myFunction()
{
}

windows.onresize = myFunction();
</script>

?>
No.. not quite.
Code:
windows.onresize = myFunction();
Would actualy execute the myFunction() routine and assign what it returns to the onresize event.

Code:
function myFunction ()
{
	alert('We were resized!');
}
window.onresize = myFunction;
That should work. Depending on the size of that function this might look cleaner in your code:
Code:
window.onresize = function () { alert('We were resized!'); };

Reply With Quote
  #5  
Old 06-18-2008, 02:08 PM
ltsf ltsf is offline
Newbie
 
Join Date: Nov 2007
Posts: 29
Thank you so much. It works perfectly.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Rackspace Details New Cloud Hosting Control Panel Features Web Hosting News 2012-08-03 16:03:35
Cloud Security Firm Dome9 Adds Group-Based Firewall Policy Management Function Web Hosting News 2012-01-25 12:41:56
Cloud Host FireHost Launches European Cloud Hosting in Amsterdam, London Web Hosting News 2012-01-25 12:49:57
FireHost Adds Scheduled Scaling Function to Cloud Hosting Web Hosting News 2011-12-15 17:05:55
Web Host CSC Awarded 10-Year, $900M Managed Hosting Contract Web Hosting News 2011-09-09 17:33:57


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?