473,802 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting empty in an IFrame

Hi,

Is there a way in .NET to convert InnerHtml text e.g. '<B>hello</B>' to
'hello' ??

In IE I can use myiframe.innerT ext to know whether a field is empty, but in
Netscape this method is not available.

myiframe.InnerH TML often has leftover html which converts to nothing in the
iframe (innertext), but is difficult to test for empty.

Any help is appreciated.
Marcel
Nov 18 '05 #1
2 1773
Simply remove all HTML tags using regular expression functions, and then
take a look at the remaining string. Here is a sample of clearing tags:

http://www.4guysfromrolla.com/webtech/073000-1.shtml
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Marcel Balcarek" <ma************ *@REM-OVEMEtoxicall.c om> wrote in message
news:e8******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Is there a way in .NET to convert InnerHtml text e.g. '<B>hello</B>' to
'hello' ??

In IE I can use myiframe.innerT ext to know whether a field is empty, but in Netscape this method is not available.

myiframe.InnerH TML often has leftover html which converts to nothing in the iframe (innertext), but is difficult to test for empty.

Any help is appreciated.
Marcel

Nov 18 '05 #2
Thanks Chris!

I ended up converting the code to javascript since iframe text is not posted
to the server.

Here are 2 functions I wrote.

Marcel
-----------------------------
function ClearHTMLTags(i nHTML) {

var regEx

var outText

// this pattern matches any html tag, g means don't stop after first

regEx = /<[^>]*>/g // or in other languages "<[^>]*>"

// remove any HTML tags

outText = inHTML.replace( regEx, "")

// remove any &nbsp;

regEx = /&nbsp;/g

outText = outText.replace (regEx, "")

// all html tags are stripped

return outText

}

// tests for an empty string - needs javascript1.2

function isStringEmpty(t extString)

{

var regexp = / /g // look for any space character and don't stop after first
g

var trimmedTxt = textString.repl ace(regexp, "") // remove any space
characters

regexp = /\s/g // look for white space \s character and don't stop after
first g

trimmedTxt = trimmedTxt.repl ace(regexp, "") // remove any white space
characters

if (trimmedTxt.len gth == 0) {

return true

}

return false

} // end: isStringEmpty()
"Chris Jackson" <chrisjATmvpsDO TorgNOSPAM> wrote in message
news:e4******** ******@TK2MSFTN GP12.phx.gbl...
Simply remove all HTML tags using regular expression functions, and then
take a look at the remaining string. Here is a sample of clearing tags:

http://www.4guysfromrolla.com/webtech/073000-1.shtml
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Marcel Balcarek" <ma************ *@REM-OVEMEtoxicall.c om> wrote in message
news:e8******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Is there a way in .NET to convert InnerHtml text e.g. '<B>hello</B>' to
'hello' ??

In IE I can use myiframe.innerT ext to know whether a field is empty, but

in
Netscape this method is not available.

myiframe.InnerH TML often has leftover html which converts to nothing in

the
iframe (innertext), but is difficult to test for empty.

Any help is appreciated.
Marcel


Nov 18 '05 #3

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

Similar topics

2
18361
by: Halldór Ísak Gylfason | last post by:
In my application I have an iframe that is empty (and not visible) initially, however when a user presses a button a form is programmatically submitted and the target is set to the IFrame. I want to detect when the frame has been loaded with the result of the form submit. Of course I have tried some event handlers like onload, onactivate, onreadystatechange, but they do not work in this example. They only seem to work, when the "SRC"...
2
2240
by: Frank | last post by:
Hello, I'm a total newbie on Javascript, and with a lot of help and some copy and paste managed to get things running. On my site: http://home.wanadoo.nl/homepage I use a form from Bravenet. This works fine. Unfortunately some persons fill in their e-mail address instead of the URL of their page. Checking is done on empty fields but how to avoid
1
4804
by: Timmy | last post by:
Hi, I have some javascript that is within an iframe's src, however I do not want to execute it until the iframe's parent has finished loading. I have tried parent.window.onload = function() but that does not seem to wait, and then throws a "not implemnted error" If any one can help it is greatly appreciated.,
3
14797
by: Dag Sunde | last post by:
Is there a way to detect if the reason an onUnload() handler was called originated from the user explicitly refreshed the page(s)? Ie. pressed "Ctrl-R", "F5" or klicked the refresh button in the toolbar or the context menu? I'm aware that I can not stop a refresh, but the reason I want to know is that I have a hidden frame in an intranet application. This hidden frame is present at all times after
9
2022
by: D. Shane Fowlkes | last post by:
I'm using SQL Server 2000 and on my page, I'm simply creating a SQLDataReader and filling in Labels with the retrieved (single) record. However, how can I prevent from getting errors when a field is null? I've tried something like this (experimenting with IsDBNull): ========================================================= If dtrData.IsDBNull("Address2") = True Then lblAddress2.Text = "" Else
5
1453
by: Russell | last post by:
Hi all, I have a web page(a) that has a link to another web page(b). Now, on the page load event of web page(b), I am doing the following: Response.redirect("./test.pdf") This pdf, if the user copies the url, can go back to it after they have logged out of my web site. I need to delete this file. I need to find a way to detect the web page is closing so I can delete the pdf file.
3
19061
by: JMcCrillis | last post by:
I've implemented a FileUpload servlet using AJAX and JS. It appears to be working well but for one issue. I used XMLHTTP so I could intercept the response in Javascript and write it out to a field on my webpage. I get back that my readyState is 4 and my status is 200 and status text is "OK", but my responseText is always empty. Both on FireFox and IE7, so it must be something I'm doing (wrong). I've also set up an IFRAME to redirect the...
3
2790
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to properly inform the user of the fact. How is ths done? Thank you, Doug
0
10536
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10304
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.