Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-03-2009
Member
 
Join Date: Jan 2009
Posts: 67
Problem Passing Data Dynamically in Java

I am having a big trouble in java orinted platform. I am totally confused as how to pass data from javascript to server.

I really don't have any idea regarding java script and java programming. Please provide some assistance regarding this problem

Please help
Reply With Quote
  #2  
Old 26-03-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Problem Passing Data Dynamically in Java

The usefulness of being able to dynamically load a style sheet is fairly limited, but there is one very good reason to keep this tool handy: it lets you load a specific stylesheet for a specific browser. Instead of having one massive style sheet for every browser which visits your page, you can break out the stylesheets into browser specific Firefox, IE, Safari, Opera, etc styles which accommodate the eccentricities of each browser and let you serve smaller css files to your visitors to boot.
Reply With Quote
  #3  
Old 26-03-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Problem Passing Data Dynamically in Java

PHP Code:
var headID document.getElementsByTagName("head")[0];         
var 
cssNode document.createElement('link');
cssNode.type 'text/css';
cssNode.rel 'stylesheet';
cssNode.href 'FireFox.css';
cssNode.media 'screen';
headID.appendChild(cssNode); 
Reply With Quote
  #4  
Old 26-03-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Problem Passing Data Dynamically in Java

PHP Code:
var headID document.getElementsByTagName("head")[0];         
var 
newScript document.createElement('script');
newScript.type 'text/javascript';
newScript.src 'http://www.somedomain.com/somescript.js';
headID.appendChild(newScript); 
It's really that simple. headID gets the <head> element of the page. Next we create a new 'script' element, assign it a text/javascript type, and then the url of the script (which can be anywhere on the net since it's basically a javascript include). Finally we append the new element to our head section where it is automatically loaded.

If you're loading an external javascript and you need to know when the script has loaded you can simply use .onload=yourfunction; to set up the onload handler. Here's an example.

PHP Code:
var headID document.getElementsByTagName("head")[0];         
var 
newScript document.createElement('script');
newScript.type 'text/javascript';
newScript.onload=scriptLoaded;
newScript.src 'http://api.flickr.com/services/feeds/photos_public.gne?tags=sunset&format=json';
headID.appendChild(newScript); 
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem Passing Data Dynamically in Java"
Thread Thread Starter Forum Replies Last Post
Passing by reference in Java Amy Adams Software Development 5 06-04-2010 11:17 AM
Passing optional parameters in java Miles Runner Software Development 5 05-03-2010 10:20 AM
Java properties / variables dynamically Miles Runner Software Development 5 04-03-2010 11:31 AM
Message Passing in Java rashmi_ay Software Development 5 25-02-2010 10:33 PM
Java & Oracle: Passing Date garfield1 Software Development 5 04-01-2010 12:30 PM


All times are GMT +5.5. The time now is 12:03 PM.