473,406 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Serialize Selection object?

Hello,

Is there a chance to serialize a selection/range object (holding the selected by the user text fragment) on a webpage, so that I could deserialize it later on
this site and make this selection/range programatically or apply a different style to it?

Regards,
g.
Aug 2 '07 #1
4 2568
greenman wrote:
Is there a chance to serialize a selection/range object (holding the
selected by the user text fragment) on a webpage, so that I could
deserialize it later on this site and make this selection/range
programatically or apply a different style to it?
See
<URL:http://groups.google.com/group/mozilla.dev.tech.dom/tree/browse_frm/thread/fc8732ee11aba5cc/5116179f922387d0?rnum=11&_done=%2Fgroup%2Fmozilla. dev.tech.dom%2Fbrowse_frm%2Fthread%2Ffc8732ee11aba 5cc%2F5116179f922387d0%3Flnk%3Dst%26q%3D%26rnum%3D 1%26#doc_5116179f922387d0>
it has an example for Mozilla and Opera to store teh selection in a
cookie and restore it.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 2 '07 #2
greenman wrote:
Hello,

Is there a chance to serialize a selection/range object (holding the
selected by the user text fragment) on a webpage, so that I could
deserialize it later on this site and make this selection/range
programatically or apply a different style to it?

Regards,
g.
Hi,

Serializing isn't difficult.
Just think up 2 seperators you don't use in the selectbox, eg:
| means seperator between name and value
# means seperator between different entries.

Then you'll end up with a string like:
10|low#20|medium#30|high
for
<select name="bla">
<option value="10">low
<option value="20">medium
<option value="30">high
</select>

But where do you want to store this serialized string?
In a cookie?

Can you program serverside? That could make more sense.
Serverside you could use an include for a complex select, that needs for
example a lot of database activity to produce.
Please give more information so we can help you better.

Regards,
Erwin Moller
Aug 2 '07 #3
Martin Honnen wrote:
greenman wrote:
>Is there a chance to serialize a selection/range object (holding the
selected by the user text fragment) on a webpage, so that I could
deserialize it later on this site and make this selection/range
programatically or apply a different style to it?

See
<URL:http://groups.google.com/group/mozilla.dev.tech.dom/tree/browse_frm/thread/fc8732ee11aba5cc/5116179f922387d0?rnum=11&_done=%2Fgroup%2Fmozilla. dev.tech.dom%2Fbrowse_frm%2Fthread%2Ffc8732ee11aba 5cc%2F5116179f922387d0%3Flnk%3Dst%26q%3D%26rnum%3D 1%26#doc_5116179f922387d0>

it has an example for Mozilla and Opera to store teh selection in a
cookie and restore it.
Many thanks for this answer!

The script on http://home.arcor.de/martin.honnen/j...election1.html works really impressive, and - together with Your post on
mozilla.dev.tech.dom - that was exactly the approach I was looking for.

Best regards,
g.
Aug 3 '07 #4
Erwin Moller wrote:
[...]
Serializing isn't difficult.
Just think up 2 seperators you don't use in the selectbox, eg:
| means seperator between name and value
# means seperator between different entries.

Then you'll end up with a string like:
10|low#20|medium#30|high
for
<select name="bla">
<option value="10">low
<option value="20">medium
<option value="30">high
</select>

But where do you want to store this serialized string?
In a cookie?

Can you program serverside? That could make more sense.
Serverside you could use an include for a complex select, that needs for
example a lot of database activity to produce.
Please give more information so we can help you better.
Hi,

I meant the DOM:Selection object. I asked because no javascript serializing class I found recognized this type of object. But then I realized, it's - like You
said - all about certain properties (anchorNode, anchorOffset, focusNode, focusOffset), which I can obviously read, build 2 xpath expressions, and send to the
server, and then read from the server to recreate the selection on page.

Thanks and regards,
g.
Aug 3 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ian Tompsett | last post by:
H I was wondering if it possible for an object to serialize/deserialize itself from XML. I'd be guessing that it would need to use the XmlSerializer class, but that seems to want to create a...
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
10
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
3
by: MAY | last post by:
Hi, I have a problem about serialize the form controls. I wrote a test program to test serialize a from but fail (->An unhandled exception of type...
3
by: Jerry | last post by:
Hi, I have a class like the following: class A { private B _b; A (B b) { _b = b; } ...
1
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. ...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
1
by: David Lozzi | last post by:
Howdy, A little background, using asp.net 2.0, i'm using a wizard object to create a email interface for a user to email out their clientele, about 200 or so, depending on the selection. The...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.