|
Yes, you could do it using javascript.
Put the image inside a div tag that has the maximum size that you want to use to show the image, and overflow:hidden.
When the image has loaded, you can get the width and height of if and calculate the size you want it to have.
Resizing images with html does not look very good, though, and you still load the entire image file. Creating real thumbnails looks better, and saves bandwidth.
---
b { font-weight: normal; }
|
|
|
|
|
|
thanks for the help.
I agree; hard-resizing in general looks bad and wastes bandwidth. but this is just for some thumbnail images, and I would be reducing them from 100x150 to 67x100.
I ran across this solution to the problem (css):
max-height: 100px; max-width: 100px;<br />
height: expression(this.height > this.width ? "100px" : "66px");
I'm using that approach here:
http://www.summitdance.com/dev/
|
|
|
|
|
Hi there,
i have a frameset in which i have two frames. The right one loads a predefined webpage (which one is unknown to me, it depends on the user). The left one reloads the right frame from time to time using javascript.
What i want to achieve is to get the whole source string of the page in the right frame into a variable for example. How can it be done?
leftframe-source (loader.html):
<html>
<head>
<title>Frameset mit Sitemap</title>
<script type="text/javascript">
var aktiv = window.setInterval("loaded()", 5000);
function loaded() {
top.frames['rightframe'].location = 'http://www.heise.de';
return true;
}
</script>
</head>
<body onload="loaded()"></body>
</html>
frameset:
<html>
<head>
<title>Frameset mit Sitemap</title>
</head>
<frameset cols="10,*">
<frame src="loader.html" name="nav">
<frame src="http://www.heise.de" name="rightframe">
</frameset>
</html>
Any help is appreciated and thanks in advance
Trollpower
|
|
|
|
|
If the page comes from a different domain, you can't. For security reasons you can't do anything at all with a page from a different domain.
---
b { font-weight: normal; }
|
|
|
|
|
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
|
|
|
|