Monday, August 29, 2011

Re: Manipulate a <div> section in the html page

On 08/29/2011 09:38 AM, Kevin Courtney wrote:
> Hello,
>
> As a followup, I'm having a heck of a time trying to find an example
> and figure out the syntax and values for the properties to set.
>
> I've tried this:
>
> DivElement divIntroPageElement =
> DivElement.as(Document.get().getElementById("introPage"));
>
> //divIntroPageElement.setPropertyString("visibility",
> "hidden");
> //divIntroPageElement.setPropertyString("display", "none");
> divIntroPageElement.setPropertyString("style.display",
> "none");
>
> ...and none of them work.
>
> Do any of you any of you have any insights on what I should pass to
> the setPropertyString method (assuming that is the method I should be
> using).?
>
> Thanks,
>
> Kevin

Try wrapping the DIV in an HTML tag and using setVisible
See

http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/HTML.html#wrap%28com.google.gwt.dom.client.Element%29

So, it would be

HTML.wrap(Document.get().getElementById("theId")).setVisible(false);

To reiterate, this probably is not what you really want to be doing.

>
> On Aug 28, 5:40 pm, Kevin Courtney <kevinjcourt...@gmail.com> wrote:
>> Thanks Jeff, exactly what I'm looking for,
>>
>> Kevin
>>
>> On Aug 28, 1:23 pm, Jeff Chimene <jchim...@gmail.com> wrote:
>>
>>
>>
>>
>>
>>
>>
>>> On 08/28/2011 12:09 PM, Kevin Courtney wrote:
>>
>>>> Hello,
>>
>>>> In my default html page that drives my GWT app, I would like to have
>>>> some html text, etc. within a <div> section. Then in GWT be able to
>>>> make that <div> section invisible and visible.
>>
>>>> Is this possible and if so, what is the syntax?
>>
>>> There are a variety of ways to do this. I'm sure others will provide
>>> their solutions.
>>
>>> Here's one to get you started:
>>> Attach an id to the div tag, then in the GWT, use
>>> DivElement divElement =
>>> DivElement.as(Document.get().getElementById("theId"));
>>
>>> Although this will give you the hook you need, you probably want to just
>>> delete the element from the DOM, then replace it with one or more GWT
>>> widgets.
>>
>>>> My goal is to have my home page intro text and images in the HTML page
>>>> so that the search engine robots will parse it but then once the user
>>>> is using the site, hide the section and replace it with the content
>>>> from the GWT code.
>>
>>>> Thanks,
>>
>>>> Kevin Courtney
>>>> http://www.beatlessongsandvideos.com/
>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment