Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT
Accepted Solution

How to popup a description screen on html?

Situation:

After document.write(), the App is stopped.

 

Question:

How to popup a description screen on html?

Do you know the following code is wrong or other issues?

 

Purpose:

Show a content on the screen.

 

Minmum coding: (Three methods are good to try, but fail)

//Method1

function help(){
var myWindow=window.open('','Help','width=600,height=200');

...........stop here..........................
myWindow.document.write("<p>To start </p>");
myWindow.focus();

//Method2
var popup = window.open('', 'Help', 'width=600,height=200');

...........stop here..........................
var doc = popup.document;

doc.write("<!doctype html><html><head></head><body><p>To start </p></body></html>");
}
//Method 3
function help(id){

var content = document.getElementById(id).innerHTML;

var generator=window.open('','name','height=600,width=200');

...........stop here..........................
generator.document.write('<html><head><title>Popup</title>');

generator.document.write('</head><body>');

generator.document.write('<p>This page</p>');

generator.document.writeln(content);

generator.document.write('</body></html>');

generator.document.close(); 

}

 

If you know how to solve the issue, please share your suggestion or solution.

 

Fight with Playbook.

 

 

 

-Fight with BB10
Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: How to popup a description screen on html?

Never (ever ever ever) use document.write. It can cause way more harm and confusion than good.

 

 

If you want to display a custom dialog box with text inside of it, the easiest way is to use jQuery Mobile:

http://jquerymobile.com/demos/1.2.0-beta.1/docs/pages/page-dialogs.html

 

 

Otherwise you can create your own using a <div> element with some custom CSS, like this

 

HTML:

<div class="dialog"> this is my description </div>

 

 

CSS:

.dialog {
   max-width: 30em;
   border: solid 0.25em black;
   background-color: #ddd;
   padding: 1em;
   display: inline;
   position: relative;
   left: 10em;
   top: 3em;
}

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: How to popup a description screen on html?

Thanks your quick response. Don't use document.write(). Good point. Solution: $(document).ready(function() { $dialog = $("

To start using this application

").dialog({ autoOpen : false, title : 'Help' }); });
-Fight with BB10
Developer
Posts: 124
Registered: ‎11-05-2011
My Device: Z10, Bold 9900
My Carrier: Smartone

Re: How to popup a description screen on html?

If you don't mind using some WebWorks specific API, you could consider using http://developer.blackberry.com/html5/api/blackberry.ui.dialog.html