|
sorry about my english...
I'm using a one input type='file' and one input type='submit' in a form with method='post'...
Problem:
- On InternetExplorer 6.0 (beta 7 too) when the value of input file is any garbage like 'sasdfa' the submit doesnt work.
probably cause the IE know with 'sasdfa' is a invalid file....
On firefox the submit works fine..
What i Need:
- I wanna know the same think IE knows(if the file is valid or not) at client side by javascript on form 'onSubmit' method.
I dont want use a RegEx over the input file text value.
I'm just looking for some way to know if the file is valid.. or not..
thanks!
blitzkrieg bop!!
|
|
|
|
|
|
|
There are a number of ways to achieve that effect - too many for me to go over here.
Search for "CSS Rollover"[^] or ":hover pseudo-class"[^] and see what appeals to you...
----
Bots don't know when people die.
--Paul Watson, RIP
|
|
|
|
|
Hi,
Just promise me not to ask why I am doingthings this way when there is a built in alternative, the sory is long and painful.
I need to transfer a file from a client PC running a (potentially any) web browser to a server for storage into a database. Sounds simple. Use the and all will be well. Apart from these files could be any size upto 80Mb
Performance and the system being tied up for a while is an issue. So I hit on the idea of splitting the document into chucks, sending each chunk asynchously via AJAX to the server to be popped into the db a chuck at a time.
Next technical question was how to get block across so came up with Base64 encryption. I don't thing I can rely on all DOMS supporting bin.base64 for a datatype. If I am wrong then this may will go away but for now lets press on.
I have written/borrowed a Javascript routine to take a block and encode it. I think I have handled the fact that charCodeAt returns UNICode representations using the following
switch(this.charCodeAt(i)) {
case 0x20AC: return 0x80; break;
case 0x201A: return 0x82; break;
case 0x0192: return 0x83; break;
case 0x201E: return 0x84; break;
case 0x2026: return 0x85; break;
case 0x2020: return 0x86; break;
case 0x2021: return 0x87; break;
case 0x02C6: return 0x88; break;
case 0x2030: return 0x89; break;
case 0x0160: return 0x8A; break;
case 0x2039: return 0x8B; break;
case 0x0152: return 0x8C; break;
case 0x017D: return 0x8E; break;
case 0x2018: return 0x91; break;
case 0x2019: return 0x92; break;
case 0x201C: return 0x93; break;
case 0x201D: return 0x94; break;
case 0x2022: return 0x95; break;
case 0x2013: return 0x96; break;
case 0x2014: return 0x97; break;
case 0x02DC: return 0x98; break;
case 0x2122: return 0x99; break;
case 0x0161: return 0x9A; break;
case 0x203A: return 0x9B; break;
case 0x0153: return 0x9C; break;
case 0x017E: return 0x9E; break;
case 0x0178: return 0x9F; break;
default: return this.charCodeAt(i); break;
I use FSO.OpenTextFile to gain access to the binary file. All seems to work correctly however there seems to be some corruption in the transmitted file. Its an XL file and the file sizes are correct when checked. However when I open the transmitted file it reports bad format. The readable text looks correct so it must be something in the encode/decode of the binary.
Whilst the encode is Jscript when I decode its VB6 code. On that side I just read the character from the string, decode and use chr$ to add it to the decoded string.
Anyone any ideas please.
|
|
|
|
|
|
Many thanks for the pointer.
I have now solved the issue. It turned out that the decode routine on the server had a bug when handling certain values. This has now been resolved and all works well.
|
|
|
|
|
With a large spectrum of Popup Blockers in place there are also sites, which are able to detect that a Popup Blocker is active and asks us to deactivate it.
Somesites are able to override and show a Popup. Experts-Exchange (without logging on) would be able to show a popup. Rediff.com too.
Any clue on what JavaScript trick is being used?
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
dear all;
does any one know how to extract text nodes from a web page. by text nodes i mean "free text". ie, text without tags
by the way i am using the web browser control.
Thank you
llp00na
|
|
|
|
|
Just use the innerText property of the body element. You don't say what language you use so it's hard to be any more specific.
Steve
|
|
|
|
|
oh sorry,
I am using Visual C++
llp00na
|
|
|
|
|
I am also confused !!! How is a node text represented in the DOM. ie, some text without a tag
llp00na
|
|
|
|
|
please consider the following node:
<p> this is some text </p>
innerText will get me "this is some text". But it does not help deciding if this the node is a text node or not. In this case it is not as it has got a tag <p>
your suggestion works in similar cases to:
<td>
some text
<a> first link </a>
<a> second link </a>
<td/>
In this example "some text" is a text node. clearly its a child node of <td> and has got no tag.
I hope i correctly understand the problem because its confusing me. do you have any views on that ?
llp00na
-- modified at 5:39 Thursday 2nd March, 2006
|
|
|
|
|
Try this:
--------
<html>
<head>
<title>Test</title>
<script>
function Loaded()
{
alert(TheBody.innerText);
}
</script>
</head>
<body id="TheBody" onload="Loaded();">
The quick <b>brown</b> fox <b><i>jumps</i></b> over the lazy fox.
</body>
</html>
--------
This HTML will get all the text - even text inside child tags. Is this what you want?
Steve
|
|
|
|
|
thanx for your reply steve.
unfortunately its not what i am trying to do.
I am trying to asses whether an html element is a text node (an element without a tag). But i dont know how to achieve that.
llp00na
|
|
|
|
|
As I understand it a HTML element is never a text node - It can contain text nodes however. For example the following HTML:
<p>Text</p>
Could be viewed as follows:
<p><text_node>Text</text_node></p>
Where <text_node> indicates a text node.
Another example. The following HTML:
<p><b>T</b>ext</p>
Could be viewed as follows:
<p><b><text_node>T</text_node></b><text_node>ext</text_node></p>
Steve
|
|
|
|
|
I see, so are implying that any html element should always have a tag ???
In case where the user does not specify a tag, it gets assigned by the web browser !!!
Okey in your representation
<p><b><text_node>T</text_node></b><text_node>ext</text_node></p>
(T) has got two tags "b and text_node". the second element (ext) has got only one tag being "text_node". Now is there any way to spot this difference? Because thats what i am trying to do.
Thank you
llp00na
-- modified at 7:14 Thursday 2nd March, 2006
|
|
|
|
|
If you use the "normal" interfaces such as IHTMLElement and such you can't see this directly. If you use the IHTMLDOMNode family of interfaces the structure I mentioned previously can bee seen. Text nodes will implement the IHTMLDOMTextNode interface.
Steve
|
|
|
|
|
thanx Steve.
I will look into that. Is there any way to get the IHTMLDOMText from the IHTMLElement interface ???
llp00na
|
|
|
|
|
Thanx for ur valuable advice Steve.
I think i can use IHTMLElement4::getAttributeNode to get IHTMLDOMAttribute2. nodeType of this interface will allow me to specify the type of the node ie. text node, element node.
but i am not sure quite sue what do they mean by text node and element node !!!
do u have any idea ?
llp00na
-- modified at 11:28 Thursday 2nd March, 2006
|
|
|
|
|
I don't believe you can get a IHTMLDOMTextNode from a IHTMLElement interface because the basic philosophy is different - The IHTMLElement family doesn't include text nodes but exposes the text info using the IHTMLElement::get_innerText method. The IHTMLDOMTextNode exposes text nodes W3C style. You can get a IHTMLDOMNode from a IHTMLElement however - By QIing I believe. Can you explain your problem in more detail? Perhaps then I can give some concrete advice.
Steve
|
|
|
|
|
Thanx for you reply and infinite patience;
I am parsing an html DOM tree and trying to extract text with no tags (lets call it: text node or free text).
The way i approached this problem is as follows:
1-I have implemented an internet explorer web browser (the usual way, by adding a microsoft web browser control into my MFC application).
2-I am retrieving the IHTMLDocument2 interface from the IWebBrowser2 interface.
3-I have then retrieved the body element from the IHTMLDocument2.
4-I am looping through the html elements of the body and assessing whether a specific element is a text node (free text) or not.
What do you think ?
Thank you again steve
llp00na
|
|
|
|
|
I'm not quite sure what you mean - all text will be inside some tag. Perhaps it will be easier if you describe the desired effect by example. ie.
<html>
<head>
<title>The title</title>
</head>
<body>
Some text.
<p>Some text.</p>
<p><b>S</b>ome <b>t</b>ext.</p>
<span>Some <b>text</b></span>
</body>
</html>
What text should be returned in this case? Or perhaps you have a better example.
Steve
|
|
|
|
|
thanx steve;
in your example, i should return the following:
<html>
<head>
<title>The title</title>
</head>
<body>
Some text. -------->> Should return this
<p>Some text.</p>
<p>
<b>S</b>
ome ------------->> Should return this
<b>t</b>
ext. ------------>> Should return this
</p>
<span>
Some ----------->> Should return this
<b>text</b>
</span>
</body>
</html>
Hopefully its much clearer now.
llp00na
-- modified at 10:12 Friday 3rd March, 2006
|
|
|
|
|
I'm still a bit confused here. In the example:
<html>
<head>
<title>The title</title>
</head>
<body>
Some text. -------->> Should return this
<p>Some text.</p> <<----- STEVE: We don't return this?
<p>
<b>S</b>
ome ------------->> Should return this <<----- STEVE: But we do return this?
<b>t</b>
ext. ------------>> Should return this
</p>
<span>
Some ----------->> Should return this
<b>text</b>
</span>
</body>
</html>
Can you explain the bits marked with "STEVE"?
For this bit:
<p>Some text.</p> <<----- STEVE: We don't return this?
If I added the modified it as follows:
<p><b>new bit</b> Some text.</p> <<----- STEVE: We don't return this?
What difference would it make?
Steve
|
|
|
|