Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Objects
 HtmlDlgSafeHelper (Dialog Helper) O...
HtmlDlgSafeHelper (Dialog Helper) Object

Provides access to the color dialog box, block formats, and system fonts collections.

Members Table

The following table lists the members exposed by the HtmlDlgSafeHelper object.

Collections
Show:
CollectionDescription
blockFormats Retrieves a collection of strings that specify the names of the available block format tags.
fonts Retrieves a collection of all the system-supported fonts.
MethodDescription
ChooseColorDlg Opens the system color-selection dialog box.
getCharset Gets a Variant that specifies the character set of a given font.

Remarks

HtmlDlgSafeHelper (Dialog Helper) was introduced in Microsoft Internet Explorer 6

To create this object, use the OBJECT element and provide the class identifier (CLSID) for the dialog helper.

Example

This code creates a dialog helper object which can be referenced by its id value.

<OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px">
</OBJECT> 
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
I got a problem      toydiary ... John Sudds   |   Edit   |   Show History

Hi dear~

I got a problem.

Can you help me?

I want to get random font that not borken text(include text of local -> korean text, japan text, english text..) .

I wrote javascript codes that "setInterval" and "Dialog Helper Object".

the below codes are example... so, How can i repair codes?

The codes:

<object id="dlgHelper" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></object>
<script type="text/javascript">
var CallFuncSpeed = 120;
function GetRndFont() {
 try{
  var nSystemFontCnt = Math.floor((Math.random()*(dlgHelper.fonts.count))+1);
  return dlgHelper.fonts(nSystemFontCnt);
 }
 catch(err){
  document.getElementById('log').innerHTML += nSystemFontCnt;
 }
}
function SetRndmFont(){
 TextObj.style.fontFamily = GetRndFont();
}
function StartSwitchingFont(){
 setInterval("SetRndmFont()",CallFuncSpeed);
}
if(document.all) { //IE
 window.onload = StartSwitchingFont;
}
</script>
<div id="log"></div>
<div id="TextObj" style="width:98%;height:30px;text-align:center;font-size:large;background-color:#ddd;">This is a test.</div>

You can have random font. but sometimes, You can seeing broken text...
I don't wana see booken text.

[JSUDDS.MSFT] Your code contained an error. Apparently, the collection of fonts does not start at 0--it starts at 1. So, occasionally your nSystemFontCnt variable would be set to zero, and the object would return an error. I have replaced your code above with a working example.

Tags What's this?: dhtml (x) Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker