<a> tags

Results 1 to 2 of 2

Thread: <a> tags

  1. #1
    Join Date
    Dec 1969

    Default <a> tags

    I have an image that I&#039m using as a link.<BR>I&#039m using the onclick method to post the page to another so that the details can be used in a sql query.<BR><BR>The html & j-script looks like this:<BR><BR>&#060;IMG src="images/compname.gif" onclick="Fetch()"&#062;<BR><BR>function Fetch() { <BR> document.frmContent.action="results.asp";<BR> document.frmContent.method="get";<BR> document.frmContent.submit();<BR> } <BR><BR>However I want the image to look like a link so that it has the has the fingers icon shown and so that it has a tab stop.<BR><BR>Therefore I&#039m putting the image inside &#060;a&#062; tags.<BR>When the image is clicked I want to change the href attribute of the &#060;a&#062; by using a javascript function so that suitable text is appended.<BR><BR>function SetSearchType() { <BR> document.frmContent.Atag.href="develop1.asp?Search Type=" & document.frmContent.SearchType.value;<BR> }<BR><BR>However at this point I get an error saying that &#039Atag&#039 is not a valid object.<BR><BR>What am I doing wrong ?<BR>Am I going about this the wrong way ?<BR><BR>Thanx<BR><BR>P.<BR><BR><BR>

  2. #2
    keith5000 Guest

    Default RE: <a> tags

    I can only think of a solution that works in Internet Explorer:<BR><BR>give your &#060;A&#062; tag an ID:<BR>&#060;a id="Atag" href="..." ...&#062;....&#060;/a&#062;<BR><BR>your function can say this:<BR>function SetSearchType() { <BR>document.all.Atag.href="develop1.asp?SearchTyp e=" + document.frmContent.SearchType.value;<BR>}<BR><BR> &#060;A&#062; tags aren&#039t included in the forms collection, but the ID places it in the ALL collection.<BR>Also remember to use a + instead of & for string concatenation in Javascript.<BR><BR>This won&#039t work in Netscape because it won&#039t support the ALL collection and the ID attribute.<BR><BR>Hope that helps!<BR><BR>keith

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts