|
|
Hi,
I'm having a RadioButtonList that has two RadioButtons. One has "Good Mood " and the other one "Bad Mood". But I want whe one is selected it may come with a particular smilie. How could I go about this?
Thanks
|
|
|
|
|
How can i get the selected text of a document in javascript.
var text = document.Selection.createRange().text;
When i use above line of javascript, i come across the following problem.
If the word to be selected occurs at several times at several locations in the document and if i select a word any where in the document,only the first occurence of that word is being taken into account.
The selected particular word at paticular position is not considered.
|
|
|
|
|
|
sudidelaravindra wrote: var text = document.Selection.createRange().text;
This, on IE, will give you a string representation of what the user has selected. That's all - you don't get the position in the document, what nodes are included, etc. - for those, you'll want to examine the range object directly.
What are you trying to accomplish?
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
|
|
|
|
|
based on the selected text i get length of selected text.If i add this length of selected text to the starting index of selected text ,i will get end index of the selected text.
var element = document.getElementById('lblselectedtext').innerText;
//here entire text is stored in element variable.
var selectedText = document.selection.createRange().text;
var startingIndex = element.indexOf(selectedText);
var endIndex = startingIndex + selectedText.length;
here the problem is the first occurence of the selectedText's startingIndex is always taking into the account.
Eg.
"Practice more on javaScript.The more we practice the more we acquire."
is the sentence we have.
If i select the word "more" which occured at the second time in the above sentence and tried for its starting index it should give '32' as the starting index but i am getting the starting index of first occured "more" i.e '9' as the starting index.
Hope u understand the problem.
|
|
|
|
|
I see. Sadly, indexOf() isn't terribly useful for this sort of thing, for just the reason you've found. Try something like this:
var selRange = document.selection.createRange();
var compRange = document.body.createTextRange();
compRange.moveToElementText(element);
var startDist = 0;
while (selRange.compareEndPoints("StartToStart", compRange) > 0)
{
++startDist;
selRange.moveStart("character", -1);
} (full example: here[^])
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
|
|
|
|
|
http://www.quirksmode.org/js/selected.html
-------------------------
Don't worry, be happy )
|
|
|
|
|
Hi there,
I am passing following in html:
<a href=phpFilepath?action=tagClicked&uploadId=2 rel = 'tag' >associatedText</a>
now on clicking on associatedText I am getting uploadId in php and from that I am fetching server Path that is stored in database.
suppose my server path = "ftp://userName:Password@ftp.example.com/TempUpload/Doc/Case Studies for Uploading.doc"
this is giving me not readable result of the file.
Can you please tell me how can I open the file in readable manner??
|
|
|
|
|
So is the problem that you cannot read the file from the FTP server?
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
No I got the file in the same browser with not readable fonts that are like square, circle etc. But I want the same file in open another browser with the same formating that has been in the file located at the server.
|
|
|
|
|
If i understand correctly you want them to be able to, say, have the "save file" dialog pop up. If so you want:
header(<code><span class="string">'Content-Disposition: attachment; filename="[FILE NAME]"');</span></code> <span class="string"></span>
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
No dear,
I want just the file from the server that is only readable. the user can not save it directly.
suppose there is a ".doc" file and the user click on it's link then he should read the content of that file from the window itself.
|
|
|
|
|
Then you are going to need the "Content-type: [content type]" header. You can get the value when it is first uploaded:
$fileType = $_FILES['NAME']['type'];
str_replace("\n", "", $fileType);
str_replace("\r", "", $fileType);
header("Content-type: {$fileType}");
echo $File;
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
Hi,
Actually what I am doing is:
1> The user will upload a file to the server
2> I am storing that file information like, server path with file name and extension, associated text(show to the user by clicking on which it will show the file on that path that is stored for that text)
3> Now the another user wants to open that uploaded file so he will search by associated text and will get some link with them.
4> Now when he will click on some associated text, the path for that text will be there and the file should display over there or in another window to that user.
upto 3rd point is working properly but 4th point is not.
Hope you can get better idea from this what I want to do.
I am waiting for your reply.
|
|
|
|
|
Hmm, well when they file is uploaded could you not store the file type when they upload it?
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
well I can store the type too.
|
|
|
|
|
Wit, now i think i know what the problem is: is it that you don't know how to get the file for the user?
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
You got the problem that I am having
|
|
|
|
|
Have you any idea how can I get the file from server and show it to the user as per its format???
|
|
|
|
|
Ok do you mean just send it to them as if they have requested it from the server normally or do you mean in a way that the browser will save it to disk?
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
I want that dialogbox that will ask the user to save or open the file he is asking for.
The dialogbox that is appears for normally we are downloading some attachment from the mail which asking to open file temporary or want to save it.
|
|
|
|
|
The code I gave you before (Content-disposition) will do that for you.
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
Its give me an error "Warning: Cannot modify header information - headers already sent" on following line,
header("Content-type: {$fileType}");
do you have any alternative??
|
|
|
|
|
Ok this error is because you have not started the document with the <?php tag.
Although this is a common mistake it is made by many people.
Make sure there is no blank space in the file before the php tag and make sure that you don't echo or print anything to the browser before the header function executes.
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|