Programmatically Change the styleClass of a Web page element

Somehow this should be very simple. But being new to jsp, I am unfamiliar with how to do this. Lets say I have some element on a page that looks like this:
<div id="testElement" class="class1">test text</div>
I have class1 and class2 defined in my jsp page style section
How do I reference the testElement item in order to change the styleClass.
I tried using something like this:
<%
testElement.setStyleClass("testClass2");
%>
I realize I am missing something very basic here. Any help is much appreciated.

You are mixing up java/jsp with javascript.
These two things are not the same, even if they have similar names.
Java/JSP runs on the server, and produces an HTML page.
Javascript runs on the client (inside the browser) and handles button clicks/dynamic changing of the page.
In this case you are wanting to use javascript.
I think it would be something like
<script>
testElement.className = 'testClass2';
</script>
<style>
  .redText  {color: red;}
  .blueText {color: blue;}
</style>
<div id="testElement" class="redText">  This is an example</div>
<button onclick="testElement.className='redText'">Red</button>
<button onclick="testElement.className='blueText'">blue</button>

Similar Messages

  • How do I change my name that appears when I post a question on the apple support communities web page

    How do I change my name that appears when I post a
    question on the apple support communities web page?

    This isn't possible without creating a new Apple ID.
    (83040)

  • Why can't i access or click on the menu options at the top of ANY web page? Also, Can't close a moddle window using the x in the upper right,?

    Why can't i access or click on the menu options at the top of ANY web page? Also, Can't close a moddle window using the x in the upper right,?

    Problems with buttons and links at the top of the page not working can be caused by an extension like the Yahoo! Toolbar or a Babylon extension that extents too much downwards and covers the top part of the browser window and thus makes links and buttons in that part of the screen not clickable.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode

  • Hello, I need some help on renaming the title on mi web pages!

    Hello, I need some help on renaming the title on mi web pages! appear to be locked by the template and I would like to know if is posible rename each page with diferent title? Thanks,

    @ Gary: No, there is no need to specify an editable region in the page title.
    If you make a template from a page, by saving it as a template (using "save as template"), the page title is automatically made editable.
    @ Jesus: if you look into the code of your template or of any childpage, it should read like this:
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Mi PageTitle</title>
    <!-- TemplateEndEditable -->
    meaning that the page title is indeed editable.
    If it does not look like this, something went wrong.
    Maybe do a little test, save your page as a template and see if the code reads as above.
    It is important that you keep your templates in the Templates folder in your root folder
    Do not move the folder or change its name, otherwise it will not work.

  • How come my iweb template is half the size of my web page is their any way to expand it.

    How come my iweb template is half the size of my web page is their any way to expand it.

    The Inspector is the blue circle with the I.
    The Inspector has 10 icons.
    Each icon represents a purpose :
    Adding hyperlinks,
    Changing the textformatting,
    Changing the width and height of objects,
    Changing the page settings,
    If you're familiar with a wordprocessor you will recognize most icons.
    There's also an often ignored word in the menu bar : HELP
    See if that helps you any further.

  • How to change the default Real-Time Collaboration page?

    Who can tell me how to change the default Real-Time Collaboration page?
    If I want to add my corporation logo in the top of the default page.How to do?
    Thanks!

    Thanks for your help.
    "Click the Sites tab to display all sites and their IDs for your system." But I clicked the sites tab ,it showed "http://hostname:7777/imtapp/app/home.uix". I could not find the siteID parameter from it. Why?
    How to get it from command?

  • The list of open web pages just flipped from right to left. How do I get it back on the right? Thankyou.

    The list of open web pages, which normally sits bottom right on my screen, flipped to the left. How can I move it back to the right?
    I clicked Alt + tab and saw 'Deplacer' (Reposition - I'm in France). Then the cursor became a thing like a crossroads and I clicked where I wanted to put the list of open pages but nothing happened.

    You may have placed the bookmarks icon on the Navigation Toolbar to open the bookmarks in the sidebar instead of the bookmarks menu button that opens a drop down list.<br />
    There are two icons available for opening or accessing the bookmarks that both have a star.<br />
    The icon with the drop marker opens the drop down list with the bookmarks (Bookmarks Menu button).<br />
    The other, without the star, opens the bookmarks in the sidebar, just like the Ctrl+B shortcut or View > Sidebar > Bookmarks
    See:
    *https://support.mozilla.org/kb/Back+and+forward+or+other+toolbar+items+are+missing
    *http://kb.mozillazine.org/Toolbar_customization

  • How do i fix my printer when it won't show the print preview for web pages? it worked and now not.

    how do i fix my printer when it won't show the print preview for web pages?  it worked for a while and now it doesn't.  printer is an hp officejet 7310 all-in-one.

    I would suspect this is a hardware issue.  The rollers are probably having issues picking up the relatively smooth thick media.  You might have better results be cleaning the paper pickup rollers with a damp paper towel.  Also make sure the paper is snugly loaded and the paper guides have been correctly positioned.
    Regards,
    Bob Headrick, MS MVP Printing/Imaging
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • I can't see the images on a web page, instead of them I get an interrogation.

    I can't see the images on a web page, instead of them I get an interrogation.This is only one page, and none of the browsers can view your images, and this happened after updating the operating system to Yosemite.

    Safari > Preference > Advanced
    Checkmark the box for "Show Develop menu in menu bar".
    "Develop" menu will appear in the Safari menu bar
    Enable Images.
    Make sure that"Disable Images" is not enabled.

  • Possible to change the charset of a Web Dynpro Application ?

    Hello All,
      Does anyone knows if this is possible ? To be able to change the charset of a Web Dynpro application or even changing it dynamically ? Thank you.
    from
    Kwok Wei

    Hello Anilkumar,
      Sorry for not elaborating further again (This is getting to be a habit ;p).
      I have the document on "international of wed dynpro application" but it appears to be more on customising the label fields to reflect the corresponding text in different languages. This is indeed a very cool idea. However, the reason why I am asking if it is possible to change the charset is because (do correct me if I am wrong)I need to display japanese and english characters and to do that I need to change the charset so that Web Dynpro can have them displayed properly. Is this assumption correct ?
      I have actually log a CSN ticket on this query as well and this is the reply "...... My understanding is that with Web Dynpro Java being based on Unicode, we don't need to charset settings. One should be able to display both Japanese and other characters in parallel, automatically, without problem."
      Your comments please. Thank you.
    from
    kw

  • How do I change the default program to open Pages docs to the old (4.3) version instead of the new one (5.0)?

    How do I change the default program to open Pages docs to the old (4.3) version instead of the new one (5.0)? When I do what Apple said and go to a Pages file in finder and select "get info" then select "Pages 4.3" and "change all" it just defaults to the new one even though I'd selected the old one. Do I need to completely uninstall the new version of Pages or is there another work around because the new version of Pages comes dreadfully short of the features I need that are included in the old one?

    Eric Kraft wrote:
    HOWEVER, if you modified a document in 5.0, 4.3 can't open it. You'll have to use Time Machine to replace the modified version with an earlier version that was last modified in 4.3.
    Actually there is a workaround.
    If you open the file in Pages 5, it can then be exported on Pages 0.9 format to another folder. I had to do this as the document was only in iCloud and couldn't be recoverd by Time Machine.
    Worked for me!

  • How to include non web pages to the "Create PDF from Web Page" feature?

    In Acrobat Pro (v. 10), when I use the "Create PDF from Web Page" feature, it works great for html pages, but it skips non-html links (doc, pdf, ppt, xls, etc). I need Acrobat Pro to convert those files and put them in the order as well. I don't see an option for this in settings. Is there ANY way I can do this? This is for an archiving purpose and I have 10,000 plus files to convert. Please help.

    This is a question i'm trying to answer too. My issue is that I have a PDF file which itself contains links to both DOC and PDF files. The end result is that I need one consolidated PDF containing all the linked files (in order).
    I can run the "create from web page" on this PDF file, and it'll download them, but not convert them. It just adds them as "jumbled" text to the end of the document. I need it to download, convert, and then append them.
    So, as isunshine3 asked above, any way to have Adobe convert the files that it finds linked when running the "create from web page"?
    THanks
    Matt

  • How do i change the format of a single page in pages 09?

    How do i change the format of a single page in pages 09?
    I want a page to be landscape within a portrait-format doc.

    Question asked and answered many times !
    Yvan KOENIG (VALLAURIS, France) jeudi 19 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k
    My iDisk is : http://public.me.com/koenigyvan
    Please :
    Search for questions similar to your own
    before submitting them to the community

  • Why in the world would Apple make the track pad LESS useful in OS Lion?  I hate that I can't g back to the top of a web page with a singe swipe.  And of course all the other gestures are totally reversed.  IMHO, this was not an imporvement.

    Why in the world would Apple make the track pad LESS useful in OS Lion?  I hate that I can't g back to the top of a web page with a singe swipe.  And of course all the other gestures are totally reversed.  IMHO, this was not an improvement.

    No one here works for Apple.
    Go to System Preferences > Trackpad > Scroll & Zoom, and uncheck Scroll direction: Natural.

  • Can I Programmatically Change the Active Group on a Hypertrend in DSC?

    I would like to know how to programmatically change the active group of a hypertrend in Labview DSC.  I saw a link which said it can be done in Lookout.  But in the DSC module, the active group is read only.
    I know of a hard way to do it.  I could save the hypertrend settings as xmlSettings to a temporary file.  The active group is one of the settings.  I could then change the active group in this text file to point to the new group and then reload the settings.  But this is not a clean way of dong it.
    Anyone know if there is a easy way?
    Solved!
    Go to Solution.

    I found a way to do it but its not very clean.  I dont know why there is not a function to change the current group.
    Here is how I did it.

Maybe you are looking for

  • Save for Web & Devices 2-up view not appearing side by side

    Hi, I'm hoping someone can help me with this issue. In Photoshop CS4, when I used to go  to the Save for Web & Devices screen, I liked using the 2-up view so I could see the difference between my original and the optimized versions. However, I've tri

  • How to prevent physical memory filling up and crashing Firefox (22.0) when watching Flash-based videos?

    This happens maybe 30-50% of the time when I watch a video online, whether it be on YouTube or other streaming site. This usually happens when the video is at least 20 minutes long, and about 8-9 minutes in. Looking at the Task Manager, my memory fil

  • PS CS5 version 12.0 x32 extended for MAC stopped detecting GPU

    Up until very recently my Photoshop CS5 was working perfectly. I was able to rotate images and canvas using the Rotate View Tool. I am not quite sure when did it exactly stop working, but I know I used it last time about a month ago. I have installed

  • Error: NDMP operation failed due to media error

    I scheduled a RMAN backup job on oracle 11g EM and sometime it failed when running datafile backup.  The log showed the error come from media layer and did not specify detail message. We used secure backup to transfer data to tape. There are 4 tape d

  • Business Rules with BPEL or ADF

    Hi, My requirement is : We have to migrate records from one DB table to another DB table. And we have to apply Business Rules on those records while they are on there journy from source DB to target DB. We have two choices to achieve this:- 1) Use BP