| | |
change the font/color of the selected text on a web page through javascript
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 4
Reputation:
Solved Threads: 0
Hi
I want to write a javascript program which will change the font/color of the user selcted text on a web page.
Is it possible to know the exact location of the selected text from the web page.
I want a user to select a text on a web page and then my javascrip code should locate this text in the web page's source file.
I dont want to search for this text in the source file of the web page.
please help!!!!
I want to write a javascript program which will change the font/color of the user selcted text on a web page.
Is it possible to know the exact location of the selected text from the web page.
I want a user to select a text on a web page and then my javascrip code should locate this text in the web page's source file.
I dont want to search for this text in the source file of the web page.
please help!!!!
•
•
Join Date: Nov 2006
Posts: 4
Reputation:
Solved Threads: 0
Hi
I am working on javascript wherein i am trying to highlight the
selected text by changing its background color.
What I want exactly is:
1) When a page is loaded, the user will select some text on the page by
clicking and draggin the mouse
2) I am able to extract the selected text as a string
3) I want to access the exact position of the selected text in the
document object I am using in javascript
Can you please tell me how to access the exact position of text at some
position in the HTML page using the document object, since the same
text string can appear multiple times in the HTML page.
I am working on javascript wherein i am trying to highlight the
selected text by changing its background color.
What I want exactly is:
1) When a page is loaded, the user will select some text on the page by
clicking and draggin the mouse
2) I am able to extract the selected text as a string
3) I want to access the exact position of the selected text in the
document object I am using in javascript
Can you please tell me how to access the exact position of text at some
position in the HTML page using the document object, since the same
text string can appear multiple times in the HTML page.
Here is a script that captures any text that has been highlighted with the cursor. In Internet Explorer, it even grabs text highlighted within a text box or textarea.
http://javascript.internet.com/page-...hted-text.html
It shouldn't be to much of a stretch to modify the code to change font size and color instead of copying it to a textbox.
http://javascript.internet.com/page-...hted-text.html
It shouldn't be to much of a stretch to modify the code to change font size and color instead of copying it to a textbox.
![]() |
Similar Threads
- Change Web Page Font Size on the Fly (Windows tips 'n' tweaks)
- Use of Image control on Web Page (ASP.NET)
- How to create a web page with scrolling menus to specific entries (HTML and CSS)
- I've tried everything...setting font of selected text (Java)
- setting font of selected text (Java)
- Opening a Web Page in a New Window (Windows tips 'n' tweaks)
- Win XP Explorer - Web Page View (Windows NT / 2000 / XP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Interpret HTTP (Content-Disposition) headers from an XMLHTTP object?
- Next Thread: Re: Cancelling a Search
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword hint html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





