1. Tom Holscher
  2. PowerBuilder
  3. Tuesday, 18 May 2021 08:48 AM UTC

Hello,

i hvae activate the designmode in my webbrowser object with:

wb_1.navigate("javascript:document.body.contentEditable='true'; document.designMode='on'; void 0")

now i try to change the font size with:

wb_1.navigate("javascript:document.body.style.fontSize = 30 ; void 0")

but it doenst work, have someone an idea how can i change it?

 

Kind Regards,

Tom Holscher

René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 18 May 2021 10:05 AM UTC
  2. PowerBuilder
  3. # 1

Try this:

javascript:document.body.style.fontSize = '30' ; void 0
Comment
  1. René Ullrich
  2. Wednesday, 19 May 2021 08:56 AM UTC
The "// Gets selection" part starts a comment. So all following in same (javascript) line is also in the comment! Remove the comment and try again.
  1. Helpful
  1. Tom Holscher
  2. Wednesday, 19 May 2021 09:00 AM UTC
the comment is removed, nothing happened:

wb_1.navigate("javascript: " + &

"var sel = window.getSelection(); " +&

"if (sel.rangeCount) { " + &

"var e = document.createElement('span'); " + &

"e.style = 'font-family:' + " + 'Times New Roman' + " + ';'; " + &

"e.innerHTML = sel.toString();" + &

"var range = sel.getRangeAt(0); " + &

"range.deleteContents(); " + &

"range.insertNode(e); " + &

"}; void 0;")
  1. Helpful
  1. René Ullrich
  2. Wednesday, 19 May 2021 09:30 AM UTC
This works for me:

javascript: var sel = window.getSelection(); if (sel.rangeCount) { var e = document.createElement('span'); e.style = 'font-family:Times New Roman;'; e.innerHTML = sel.toString(); var range = sel.getRangeAt(0); range.deleteContents(); range.insertNode(e);} void 0;



Your part that sets the font-family seems not to be ok.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.