|
Although the font size and style can affect the size of an element, there is no easy way of calculating the element size from the font size and style.
What are you going to use it for?
Perhaps you are looking for the IHTMLElement.offsetWidth and IHTMLElement.offsetHeight properties?
---
b { font-weight: normal; }
|
|
|
|
|
thanx for the reply,
no i am not looking for the offsetWidth and offsetHeight.
I wana find out the size of the FONT of the different textual elements and compare them. After that, i wana sort them out according to the size of the font. For example, if you have two seperate paragraphs, how would you know which paragraph is written in bigger FONT regardless of the number of words in each paragraph !!!
i am not trying to calculate the size of the overall block, i am only trying to get a numerical value of the SIZE OF THE FONT used !!!
any ideas !!!
llp00na
|
|
|
|
|
I see. You wrote that you wanted to compare the size of elements, that was what threw me off.
I don't think that there is a way to get the actual size that is used to draw the text. I don't think that you even can get the actual font that is used to draw the text. The style information only contains what is the desired font, size and style of the text. If the computer does not support that setting, it will choose one that supposedly is as close as possible. For example, if the font specified in the style is not installed on the computer, it will choose another font.
To furter complicate the matter, font sizes isn't always comparable across fonts. For example Verdana 10px looks a bit larger than Times New Roman 10px.
---
b { font-weight: normal; }
|
|
|
|
|
is there a way i can use javascript to do what i can do with
"Request.Form("field")" to get the info off the page before my current page. i am looking for something to run at the client computer
thanks
chad
|
|
|
|
|
No. The form data is sent from a page to the server. The server does not relay the form data into the header of the next page.
If you send the data in the url instead (post the form with method="GET") you will be able to retrieve it on the next page.
This function might be useful if you choose that method:
Javascript : querystring[^]
---
b { font-weight: normal; }
|
|
|
|
|
|
Ok, I'm working on this project, we have a need to "standardize" our address data. So, right now, I have regular expressions that will turn North 7th Street into the USPS approved standard of "N 7th St" However, we have found out that we now have customers with addresses like "North Avenue" and it is unacceptable to report it as "N Ave" So, now to my actual question, is there a way with a regular expression ONLY to verify that the next word (after north for example) is not avenue. For clarifiaction, if the word Notrh is found, check to see if the very next word is avenue, and if it is, then we don't want to match. Any help would be appreciated. Thanks!
Brian Van Beek
Here's my boring blog! [^]
|
|
|
|
|
The same way you are finding North find Avenue after it or you can look for North and a number.
Show us your code.
|
|
|
|
|
Well, here's the problem, I can't just look for a number after it, because West Duff Avenue should become W Duff Ave. Here is what I have so far...
((\b[Nn][Oo][Rr][Tt][Hh])\b)|(\b[Nn]\b\.?)
It's just a really simple regex to find the match, then I replace it with the appropriate abbreviation. This is all done during a sort of batched job. Now, I just need to be able to "not match" if the next word is avenue. But I want to do it all in one regex. Is this possible? [obviously you can tell that I'm a beginner in the world of regular expressions]
Brian Van Beek
Here's my boring blog! [^]
|
|
|
|
|
I am trying to figure out how to load one frame from an event in another. Here is me frames page
<frameset border="0" frameSpacing="0" rows="15%,80%,5%" frameBorder="0">
<frame name="top" src="index.htm" scrolling="no" width="50%">
<frameset cols="25%,75%" >
<frame name="treeframe" src="HtmlPage2.htm" scrolling="yes" >
<frame name="Content" src="">
</frameset>
<frame name="bottom" src="HtmlPage3.htm" scrolling="no" width="50%">
</frameset>
I am clicking a link in treeframes and want to load the page into Content. I have tried everything i could think of and other things I found on somne javascript sites. My page will loadinto itself or not load and casue the frame to go blank.
Any help is greatly needed and appreciated
Joe
|
|
|
|
|
The simplest way is to not use javascript at all:
<a href="PageToLoad.htm" target="Content">
---
b { font-weight: normal; }
|
|
|
|
|
I tried this but the page opens in a new window.
|
|
|
|
|
Strange. Check the spelling again.
Also try to open something in the frame initially instead of leaving src empty. It might brake the tag.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
How to Play Video file (any Format avi,mpeg,mpg,.........) in ASP.net.
Bascially, i develop a page, where some videos are present, if user click on them,then it Run.....
Plz help
Thanx in advance
Sajjad
|
|
|
|
|
Hi there,
Basically, to play a media file in an ASP.NET application, you can use a media player plugin which is installed on the client machine, for example window media player or real player ...To host the media players on the web page, you need to use the object tag, and to make the player play a media file, you simply set the url of the media file in the URL or filename property of the player (it depends on which player and which version you use) and/or use the client side script to control the player. In addition, you can also specify the url to download the media player in the codebase attribute of the object element so that the player can get downloaded when it has not been installed on the client machine.
|
|
|
|
|
Hi
i am using this script to calculate the number of character inside the header of a word document but it is not working.
wdStatisticCharactersWithSpaces = 5
wdStatisticCharacters = 3
IncludeFootnotesAndEndnotes = True
dpath = Cstr("F:\Softwares\01.doc")
Set word1 = CreateObject("Word.Application")
word1.Visible = False
word1.Documents.Open(dpath)
For i = 1 To word1.ActiveDocument.Sections.Count
text3 = word1.ActiveDocument.Sections(1).Headers (wdHeaderFooterPrimary).Range.ComputeStatistics _
(wdStatisticCharactersWithSpaces)
text4 = Cint(text4 + text3)
Next
Document.Write text4
word1.ActiveDocument.Close(SaveChanges)
word1.Application.Quit
Set word1 = Nothing
Is there anyone to help me out Thanks in advance
YasinXp
|
|
|
|
|
Pliz Help Me. I don't see any programmer to have the capability to solve this problem,
YasinXp
|
|
|
|
|
Hello everybody.
Can I pass a object to a method by reference in JavaScript? Take a look at the code:
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 1: </SPAN><FONT color=blue size=+1><</FONT>script type<FONT color=blue size=+1>=</FONT><FONT color=purple>"text/javascript"</FONT><FONT color=blue size=+1>></FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 2: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 3: </SPAN> DummyType <FONT color=blue size=+1>=</FONT> <FONT color=red>function</FONT><FONT color=blue size=+1>(</FONT><FONT color=blue size=+1>)</FONT> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 4: </SPAN>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 5: </SPAN> <FONT color=red>return</FONT> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 6: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 7: </SPAN> <FONT color=purple>"result"</FONT> <FONT color=blue size=+1>:</FONT> <FONT color=brown>0</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 8: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 9: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">10: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">11: </SPAN> <FONT color=red>function</FONT> ref<FONT color=blue size=+1>(</FONT>o<FONT color=blue size=+1>)</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">12: </SPAN> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">13: </SPAN> o <FONT color=blue size=+1>=</FONT> <FONT color=blue size=+1>new</FONT> DummyType<FONT color=blue size=+1>(</FONT><FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">14: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">15: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">16: </SPAN> <FONT color=red>var</FONT> obj <FONT color=blue size=+1>=</FONT> <FONT color=blue size=+1>new</FONT> DummyType<FONT color=blue size=+1>(</FONT><FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">17: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">18: </SPAN> obj<FONT color=blue size=+1>.</FONT>result <FONT color=blue size=+1>=</FONT> <FONT color=brown>1</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">19: </SPAN>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">20: </SPAN> ref<FONT color=blue size=+1>(</FONT>obj<FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">21: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">22: </SPAN> alert<FONT color=blue size=+1>(</FONT>obj<FONT color=blue size=+1>.</FONT>result<FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">23: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">24: </SPAN><FONT color=blue size=+1><</FONT><FONT color=blue size=+1>/</FONT>script<FONT color=blue size=+1>></FONT> The result I expected was 0 , but it's still 1 . I know I could use:
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">1: </SPAN><FONT color=red>function</FONT> ref<FONT color=blue size=+1>(</FONT>o<FONT color=blue size=+1>)</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">2: </SPAN><FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">3: </SPAN> o<FONT color=blue size=+1>.</FONT>result <FONT color=blue size=+1>=</FONT> <FONT color=brown>0</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">4: </SPAN><FONT color=blue size=+1>}</FONT> But this solution is not what I need.
Is this possible in JavaScript?
Thanks,
Stanimir Angeloff
|
|
|
|
|
Hi there,
It's impossible I think, you might want to check out the core javascript reference[^] for more information. This is an interesting question though.
|
|
|
|
|
Hi!
Thank you for your reply. I'm sure there's a way to workaround this problem. I tried this, but it doesn't work :
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 1: </SPAN><FONT color=blue size=+1><</FONT>script type<FONT color=blue size=+1>=</FONT><FONT color=purple>"text/javascript"</FONT><FONT color=blue size=+1>></FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 2: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 3: </SPAN> DummyType <FONT color=blue size=+1>=</FONT> <FONT color=red>function</FONT><FONT color=blue size=+1>(</FONT><FONT color=blue size=+1>)</FONT> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 4: </SPAN>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 5: </SPAN> <FONT color=red>return</FONT> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 6: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 7: </SPAN> <FONT color=purple>"result"</FONT> <FONT color=blue size=+1>:</FONT> <FONT color=brown>0</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 8: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff"> 9: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">10: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">11: </SPAN> <FONT color=red>function</FONT> ref<FONT color=blue size=+1>(</FONT>o<FONT color=blue size=+1>)</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">12: </SPAN> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">13: </SPAN> o<FONT color=blue size=+1>.</FONT>value <FONT color=blue size=+1>=</FONT> <FONT color=blue size=+1>new</FONT> DummyType<FONT color=blue size=+1>(</FONT><FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">14: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">15: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">16: </SPAN> <FONT color=red>var</FONT> obj <FONT color=blue size=+1>=</FONT> <FONT color=blue size=+1>new</FONT> DummyType<FONT color=blue size=+1>(</FONT><FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">17: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">18: </SPAN> <FONT color=red>var</FONT> dummyArg <FONT color=blue size=+1>=</FONT> <FONT color=blue size=+1>{</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">19: </SPAN> <FONT color=purple>"value"</FONT> <FONT color=blue size=+1>:</FONT> obj
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">20: </SPAN> <FONT color=blue size=+1>}</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">21: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">22: </SPAN> obj<FONT color=blue size=+1>.</FONT>result <FONT color=blue size=+1>=</FONT> <FONT color=brown>1</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">23: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">24: </SPAN> ref<FONT color=blue size=+1>(</FONT>dummyArg<FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">25: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">26: </SPAN> alert<FONT color=blue size=+1>(</FONT>obj<FONT color=blue size=+1>.</FONT>result<FONT color=blue size=+1>)</FONT><FONT color=blue size=+1>;</FONT>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">27: </SPAN>
<SPAN style="COLOR: #eeeeee; FONT-STYLE: normal; BACKGROUND-COLOR: #ffffff">28: </SPAN><FONT color=blue size=+1><</FONT><FONT color=blue size=+1>/</FONT>script<FONT color=blue size=+1>></FONT> Any other ideas?
|
|
|
|
|
The idea you got in reply was 'it's probably not possible', with a link to an online reference. 'Any other ideas' does not seem a valid response to me. I doubt very much that pass by reference exists in jscript, and certainly your approach (write a function called ref and hope it passes things magically by reference ) is not going to work.
It may be possible, but neither I nor your other respondent think it is. You should go to a bigger jscript forum if you hope for a better answer. Better yet, if it is possible, google is bound to know about it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you for explaining minhpc_bk's post to me.
'Any other ideas' means that I'm still asking for help. It's not a reply to minhpc_bk's post. In fact, minhpc_bk's post helped me a lot.
Christian Graus wrote:
...write a function called ref and hope it passes things magically by reference...
This is just an example, I don't hope it's going to magically work.
Google Groups - "Function arguments by reference"[^].
|
|
|
|
|
Doing so only changes the result property of the dummyArg.value , but not the obj.result . You can see that with:
alert(dummyArg.value.result);
Stanimir Angeloff wrote:
Any other ideas?
I'm not sure I have other than you'll have to edit the property of the object instead of assigning another object to the function parameter.
PS: Nice formatting!
|
|
|
|
|
Thank you again for your reply.
I'm sorry if my previous post was rude. Btw, try this CodeColorizer[^].
|
|
|
|
|
minhpc_bk wrote:
check out the core javascript reference
Nice. That gave a definite answer right away:
"All parameters are passed to functions by value"
That means that the reference to an object also is passed by value. That in turn gives that you can change the contents of the object, but you cannot change the reference to the object.
But this opens up a different way of doing it. As you can modify the contents of an object, you only have to place the reference inside an object in order to be able to change it from inside the function.
This is an example that shows an object containing a refernce to another object:
function modify(obj) {<br />
obj.ref = new String("42");<br />
}<br />
<br />
var info = new String("1");<br />
var o = new Object();<br />
o.ref = info;<br />
modify(o);<br />
alert(info);<br />
alert(o.ref);
It will create an object, and then another object that will contain a reference to it. It then passes the object to the function that will replace the reference with a reference to a new object. The code then displays the value of the first object to show that the function has not changed it's value, and displays the value of the referenced object to show that the function successfully changed the reference.
---
b { font-weight: normal; }
|
|
|
|