Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to change url onclick??? please help me

Status
Not open for further replies.

redpotato

Programmer
Feb 15, 2010
24
CA
This is my code below...

<div class="AccordionPanelTab" onclick="MM_swapImage('document','','<?php echo $filepath; ?>{filedimg}',1);document.getElementById('docLink').href='<?php echo $filepath; ?>{filedpdf}';">{formid} {description}</div>

onclick, i was trying to call 2 functions.
the first one works fine but the second part to change url does not work in FireFox and Safari.
it only works with IE8 and Chrome..
do u have any idea why??
{filedpdf} and {filedimg} are for reading from xml.

i think /document.getElementById('docLink').href/ this is not compatible with all the browsers??
 
Hi

[ul]
[li]Please do not post server-side script and template. Post the JavaScript and HTML code as they appear in your browser. ( Use the browser's View source command to get the source. )[/li]
[li]Show us all relevant code. We have no idea what and where is that docLink.[/li]
[/ul]


Feherke.
 
It sounds like you might only have a name attribute on the element in question, rather than an ID attribute.

IE will inherently copy the name attribute to the ID if no ID is present.

If this is not the case, then s Feherke says, we'd need to see some relevant code (both JS and HTML). If you do post more code, also remember to post it in [ignore]
Code:
[/ignore] tags.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Check that the id="docLink" exists. It's case sensitive, so make sure you have the exact ID name.

IE is more tolerant of these mistakes.
 
thanks guys. i will try as BillyRayPreachersSon mentioned.

thanks again :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top