Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Setting a java variable in javaScript

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Setting a java variable in javaScript

    I am not really sure if this is possible and do not have much experience in using javaScript, but I was wondering if it is possible for me to take a variable that I have declared in java and change its value in javaScript.

    I have a mixed java file that consists of both java and javaScript.

    I need to create an If statement in javaScript which takes a java variable and sets its value to null if I meet a certain condition.

    Would this be possible, and if so can someone provide me with a simple example?

    Thanks,
    Shawn


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    989
    Thanks
    7
    Thanked 207 Times in 183 Posts

    Default Re: Setting a java variable in javaScript

    Have a look at the following page from Oracle's Tutorial: Invoking Applet Methods From JavaScript Code (The Java™ Tutorials > Deployment > Java Applets)

  3. The Following User Says Thank You to pbrockway2 For This Useful Post:

    shaaaawn (September 11th, 2012)

Similar Threads

  1. Javascript Variable in JSP
    By manjula in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: June 14th, 2012, 10:07 AM
  2. Setting variable correctly in sentinel-controlled loop
    By exchaoordo in forum Loops & Control Statements
    Replies: 1
    Last Post: June 1st, 2012, 04:40 PM
  3. java to javascript
    By andrewdee in forum Other Programming Languages
    Replies: 4
    Last Post: October 19th, 2011, 09:28 AM
  4. Help setting a private static class variable
    By kyuss in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 26th, 2010, 08:09 AM
  5. Setting up the Floor for 2d JAva Game?
    By DarrenReeder in forum Java Theory & Questions
    Replies: 1
    Last Post: January 19th, 2010, 06:36 AM