codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  complicate JavaScript function  prasaddevivara at 07:16 on Friday, April 22, 2005
 

My requirement is that I want to identify the <img> tags in html page, want to place a border line for images and want to display ALT Text. If there is no ALT attribute, i want to display an image. Following function shows "NOALT" message, in place of "NOALT" I want to display an image. Place the following function in HTML page, add 4 image tags in HTML page and call the bellow function in "onload" attribute of <body> tag.



function showimage()
{
var z=0,
tag=new Array('img');
for(n=0;n<tag.length;n++)
{
t=document.getElementsByTagName(tag[n]);
{
for(i=0;i<t.length;i++)
{
{
var l;
if(t.attributes.alt.specified)
l='alt=\"'+t.alt+'\"';
else
l='<strong style=\"color:red\">NoAlt!</strong>'
}
h=t.outerHTML;
t.outerHTML='<span style=\"color:navy;font:x-small arial;background:#f5deb3;\"><b><'+tag[n]+' '+l+'></b></span> '+h;
t.style.padding='3px',t.style.border='1px solid red';
if(h!='')
z=z+1;
}
}
}
if(z==0)
alert('No Images');
}








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: email with image
•  Re: Windows Authentication using LDAP get user first name
•  Two dimentional array - Dropdown box
•  Mcrypt problem
•  datagrid - paging - print data from particular page
•  How to reorder or Re arrange the node in XSL Using ASP and VBScript
•  Multiple rows from form into XML?
•  Dhtml menu, submenu losing focus. I`m so close!
•  Re: CLICK ON ROW AND CHECK The CHECKBOX


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005