Put your text ad here
WestNIC provides reliable web hosting services
Free software downloads and drivers download resources
Top Canadian Hotels no booking fees from Victoria BC to Nova Scotia
This FAQ is part of the Code Style Help and FAQ section. Join our premium content service for full access all FAQ answers.
iframe browser and filter the URLs?
A: DHTML is an abbreviation for Dynamic HTML where Javascript is used to dynamically update the markup and styling of a Web page in the Web browser, often responding interactively with mouse actions and form input from end users. The key elements of the DHTML approach are:
Javascript event handlers are a built-in feature of most modern Web browsers and only need to be declared in the markup of the relevant HTML elements with a reference to the function that will handle the event. Event handlers can also dynamically be attached to HTML documents by reference to their position in the Document Object Model (DOM), another built-in feature of Web browsers which can be manipulated using Javascript. The DOM represents the nested markup structure of a Web page, its initial attributes and CSS styles.
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: Client side Javascript implementations in Web browsers should specifically prohibit file access. This is because it would be relatively easy to write a script that could attempt to read other more sensitive file information on the users' computer. However, it is possible to read the properties of a stylesheet indirectly using the Document Object Model, e.g.
… premium content omitted
Access all premium content for $50: sign-up now.
How do I access a CSS file using Javascript?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: The main advantages of a DOM that follows the W3C recommendations for client-side scripting is the standardisation of the programming environment.
… premium content omitted
Access all premium content for $50: sign-up now.
What are the advantages of the W3C DOM?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: This delay is a normal consequence of loading images over the network and is accepted by most users. By the time the HTML for a given image is loaded, that part of the document is likely to be displayed. If you want to ensure the space occupied by the images is filled as early as possible, you could use Javascript to specify a single pixel image then switch the master images back in place when they have loaded, as below.
… premium content omitted
Access all premium content for $50: sign-up now.
How can I hide image links while images are loading?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: An element's style.visibility property does not affect its accessibility through the document object model; if that were the case it would only be possible to hide objects, they could never be set visible again. However, you must ensure check the existence of the element reference and relevant properties before you attempt to set them, as below.
… premium content omitted
Access all premium content for $50: sign-up now.
How should I refer to a form input that is not visible?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
iframe browser and filter the URLs?
A: It is feasible to create an iframe-based browser with a basic URL input, as below. Once you have obtained the target URL, it would be possible to control the sites that are displayed using standard Javascript string methods, such as toLowerCase(), indexOf(substring), lastIndexOf(substring) and substring(from, to).
… premium content omitted
Access all premium content for $50: sign-up now.
Can I create an iframe browser and filter the URLs?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: The script below has a number of global variables to set the basic configuration for the div element below with an id attribute marquee. This provides an identifier for the DOM getElementById() method to obtain a reference to the marquee container element. The scrollMarquee() function then uses the element node's firstChild property to get a reference to the text content of the div and its nodeValue sub-property, which is the text itself. The function then “nibbles” the first character off the start of the marquee text and shifts it to the end to loop through the text.
Successive calls to the scrollMarquee() function would normally be started by an onload event handler on the body element, but this example has an onclick handler on the marquee itself to start and stop it. The scrollMarquee() function is called recursively via the setTimeout() method. Separate stopMarquee() and switchMarquee() functions use the global TIMEOUT_ID variable to check and control the movement of the marquee.
… premium content omitted
Access all premium content for $50: sign-up now.
How can I create a scrolling text marquee with DOM scripting?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: First, it is not a good idea to change link colours on a page. Users tend to identify links with a standard, fixed colour and may ignore text with a different, varying colour. People with visual impairment may also find it difficult to read the text, especially if it is the same as the custom background colour they have chosen. It is therefore important to ensure the background colour is set with the foreground colour.
The example code below creates an array of 4 named colours, a delay of 5000 milliseconds and uses the setTimeout() method to trigger the colour change. A reference to the link is obtained by assigning an id attribute to the anchor and using the DOM1 getElementById() method. The existence of the getElementById() method is checked before setting the style.color and style.background properties of the element.
… premium content omitted
Access all premium content for $50: sign-up now.
How can I make a link whose colour changes every 5 seconds?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
A: One way to change the colour of all links in a document is to use the DOM1 getElementsByTagName(tagName) method, which returns an array of all elements by the given name. The script below selects all anchor tags, then iterates through them to set their CSS color and background properties. It is important to change both properties together, to ensure there is a good contrast between the two colours.
… premium content omitted
Access all premium content for $50: sign-up now.
How can I change the default link colour?
Actions: Follow-up, clarify or correct this answer. Submit a new question.
| Front-end FAQs | Back-end FAQs | Learning Java |
|---|---|---|
About us: site help, text ads and premium content FAQs.